windows - Out of virtual memory address space (Borland C++ Builder 6 program) -



windows - Out of virtual memory address space (Borland C++ Builder 6 program) -

i have problem application written under c++ builder 6. after time of running (week, month) application crashes , closes without error message. in application log shortly before crash many "out of memory" exceptions. looked @ process when throwing out of memory exceptions (screenshot below) , has lots of uncommitted private memory space. can reason of such behavior?

i had such problem once, couple years ago. reason alternative "use dynamic libraries" unchecked in linker options. when checked problem disappeared , vice versa. test application made calling "new char[1000000]" , delete. memory freed every time (no committed memory rising in windows task manager), after time got out of memory, vmmap showed same thing. lots of reserved private memory of uncommitted.

now problem returned can't prepare same way. don't know if reason had builder 6 , 2010 istalled on same machine. have builder 6 , seems cannot reproduce error test application before. ether way seems there memory manager error or something. codeguard doesn't show memory leaks. when create memory block "new" instantly shows in "memory commit size" , when delete memory usage decreases, assume memory leaks not case, task manager doesn't show much "memory commit size".

is there can do? there way can release uncommitted memory? how diagnose problem further?

the screenshot: http://i.stack.imgur.com/ukutz.jpg

i found way simulate problem , solution.

for(int i=0; i<100; i++) { char * b = new char[100000000]; new char; delete b; }

borland memory manager reserves block of memory size multiple of 1 page 4kb. when allocating memory size different multiple of 4kb there free space borland may utilize allocate other memory chunk. when first chunk deallocated sec still keeping hole memory block reserved.

at first code should cause 100b memory leak, in fact cause memory allocation exception after less 16 iterations.

i have found two solutions problem. 1 fastmm, works brings troubles too. sec solution exchange borlndmm.dll 1 embarcadero rad studio 2010. didn't test thoroughly yet seems work without problem.

i should move hole project rad 2010 reasons got stuck in borland 6.

c++ windows memory memory-management c++builder-6

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -