|
It sounds like your allocation pattern is causing heap fragmentation. I'm not sure whether Windows 2000 or XP automatically coalesce adjacent free blocks, or whether they leave those blocks as separate blocks. I suspect that if the code from the VC6 runtime library was used or adapted, they only join the block being freed with the next block if that is also free.
You can force a full coalesce of the heap by calling _heapmin . The documentation currently states that it's only supported by Windows NT but my reading of the source indicates it should also work on 2000, XP and 2003. Under the covers this function calls HeapCompact .
One strategy to prevent the fragmentation in the first place is to allocate different size blocks, or blocks with different lifetimes, from different heaps. You can create your own heap using HeapCreate .
The heap code is really meant for small variable-size blocks. If you're creating 512KB buffers, you might be better off calling VirtualAlloc directly.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Thanks for your thoughts. Different size blocks or different heaps is not applicable here. I have modified the loop to use malloc for small blocks and VirtualAlloc for the big blocks. This gives me more stability and memory usage. But, there is always one, this code is ANSI C only, so no access to VirtualAlloc.
If it is fragmenting memory then should this not be a gradual degredation? NOT as stated, use <=520184 and immedialty you cannot alloc more? There is something odd happending in the MS implemenation of a VMM!
|
|
|
|
|
I'm curious, why do you need to allocate so much memory from the heap, to the point where you exhaust it?
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
How to set the modified time of a file as the current time?I used setFileTime()but have confusions.Can anyone give idea with exmple.Thanks in advance.
|
|
|
|
|
|
CEdit in multi-line style has two length limit, one is max text limit, which can use SetTextLimit() to solve, another is line length limit(about 1024), Does any one know how to solve it?
I search for a long time, but cannot find the solution.
Is there possible to simply solve it?
|
|
|
|
|
fangzj wrote:
Does any one know how to solve it?
Solve what? Are you wanting the text limit increased, or the line length increased? Have you considered CRichEditCtrl ?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thanks for your advise. But I just want to know it is possible to change the line length limit of a CEdit control in multi-line style. I donot want to use CRichEditCtrl or write my own control in my sample project.
|
|
|
|
|
fangzj wrote:
But I just want to know it is possible to change the line length limit of a CEdit control in multi-line style.
How are you verifying that each line of a multiline edit control is limited to 1024 characters?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
That is a very clear process:
In a dialog, put an edit control, tick multiline, horizontal scroll and auto hscroll options.
Then run the dialog app, in the edit control when you enter any character, in my test with '-', the line wraps another line if total number is great than 1024.
In fact, in any CEdit or CEditView app, like windows notepad.exe, the line wraps another line if total number is great than 1024.
|
|
|
|
|
That limit is apparently imposed by the Edit window class. Testing shows that the RICHEDIT window class does not share the same limitation. Would there be a fundamental reason to therefore not use CRichEditCtrl ?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I decide to write my own edit control from CWnd.
Ask this question, I just want to make clear that the Edit window class doe s have this limit. Microsoft should write it in the document, or update in the new version release.
Any way, Thanks!
|
|
|
|
|
fangzj wrote:
Ask this question...
What question?
fangzj wrote:
I just want to make clear that the Edit window class doe s have this limit.
Thanks for agreeing with me.
fangzj wrote:
Microsoft should write it in the document...
Agreed.
fangzj wrote:
...or update in the new version release.
Since it is not a bug, what's to update, especially since there is a work around (i.e., use the rich edit control)?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
hii..
how can i get the id's of resources of an exe ...
i want to pass the id's to the Find Resource function..
regards,
kedar.
|
|
|
|
|
I guess ResHacker will od the job:
www.users.on.net/johnson/resourcehacker[^]
All the label says is that this stuff contains chemicals "... known to the State of California to cause cancer in rats and low-income test subjects." Roger Wright http://www.codeproject.com/lounge.asp?select=965687&exp=5&fr=1#xx965687xx
|
|
|
|
|
where can I find multiple page internet explorer souce code?
thank u
|
|
|
|
|
I have a SDI project which has two views,left is a treeview,right is a list view.I want to place only one tabctrl at the botom of the two views which can over control each of the two views.How can I place the TabCtrl in the mainframe?
Thanks everyone!!!
|
|
|
|
|
Thank you all all the same!
I have solved the problem.
I used a ReBar,just created at the bottom.
|
|
|
|
|
hi all
I am maintaining an old app which works fine in 2000 and 98'
there is a printing issue which is not consistant across Windows XP boxes. On some it works fine and others it doesnt - on these "bad" ones the print preview has text is "off the page" and text is correct just too wide and large !
but as i say, on other XP pc's there is no problem and its all cool
On windows 2k and 98 there is no problem.
I figure this isnt the first time this problem has been encountered...
Is there a simple fix to make it work on all XP/2k/98 boxes or do i need to get down and dirty with the code and detect that i'm running XP and do appropriate things...also why does it work on some pc's and not others...is it a driver type issue?
cheers
Bryce
---
To paraphrase Fred Dagg - the views expressed in this post are bloody good ones.
--
Publitor, making Pubmed easy.
http://www.sohocode.com/publitor
Our kids book :The Snot Goblin
|
|
|
|
|
HI , I have already build application , now i am doing chaning in it.
I have added new items in Menu ,( say in File menu I added "Show Labels" item ).
But at runnig the application it shows "Show Labels" item Inactive ..
I checked its properties .. its all OK .
So where and how can I show it as Active item in SDI application.
thanx.
Regards.
|
|
|
|
|
Add a handler for your menu item. This should activate it from your menu.
I Dream of Absolute Zero
|
|
|
|
|
Yes it is active .. if i add handler but how can i inactive it now..
When after a specific action how can I make it Inactive....
I Mean to say that by programming ..
thanx
Regards.
|
|
|
|
|
well in the same way that you can add an event handler for your menu item, you can also add a UI (user interface) handler.
It uses the ON_UPDATE_COMMAND_UI macro.
To enable or disable your item, you would then call the appropriate method in the given CCmdUI variable.
for example:
void CMainFrame::OnUpdateViewHello(CCmdUI *pCmdUI)
{
pCmdUI->Enable(m_bEnable);
}
I Dream of Absolute Zero
|
|
|
|
|
Can any body tell me how to use Picture Control present on controls toolbar in VC6 and also animate control?
|
|
|
|
|