I have a C++ application with a very strange phenomenon.
I’m running my application on a large input, and I have many buffers that are allocated and de-allocated during run-time.
For input that it large enough, I have allocation error, meaning out of memory.
But, when I put a breakpoint on each allocation, and then run from allocation to allocation, my application won’t crash.
My assumption that it has to be something related to the way windows XP manages the memory.
Is anyone has an idea what can cause this phenomenon, and how to over come it?
Thanks.
Frequent allocation and deallocation can lead to memory fragmentation. My guess is that, when you step through the program with a debugger, it gives the OS idle-time to defragment the memory. To avoid the problem when running your program normally, you should consider memory/object-pool (see here and here).