Memory allocation on Windows XP
- From: "greg p." <greg@xxxxxxx>
- Date: 10 Feb 2006 12:13:34 -0800
I am working on an app that need a lot of memory. On Win XP 64,
everything is fine but on the 32 bit version I run in allocation
failures even though I have plenty of virtual address space free (VM
Size < 1Gb on a machine with 2 Gb of Ram + 4 Gb of swap)..
This is probably due to the pattern of memory allocation I use.
Basically the app allocates small chunks and large chunks of memory, ~
3.5 Gb each, using new [], until new fails (I have installed a new
handler via _set_new_handler() so I get notified when new fails). At
that point the VM size is usually aroung 1.7 Gb, and I free some of
these big memory chunks to give the app some breathing room. VM Size
goes down. But as the application runs, not allocating large buffers
anymore, new will fail on a small allocation (sometimes 100 bytes)
even though I just released over 30Mb of my large chunks. At the time
new fails VM Size is less than 0.8Gb and almost all the large chunks
have been released.
I suspect from browsing the newsgroups that this is because large
allocations are routed to a special heap or list using VirtualAlloc,
and basically all the address space has been reserved with those large
allocations. Is that correct?
Is there a way I can make this address space available for the small
object heap again?
Is there a way I can make the small object heap larger when my program
starts, to ensure it won't run out of space? or maybe creating a second
heap and make it available to the new operator in C++?
Any hints or suggestions would be greatly appreciated.
Best regards,
greg
.
- Prev by Date: Re: SymInitialize
- Next by Date: Re: Shutdown system from a process running on Winlogon desktop
- Previous by thread: Re: file content sourced out
- Next by thread: Re: Memory allocation on Windows XP
- Index(es):
Relevant Pages
|