Any useful suggestions to figure out where memory is being free'd in a Win32 process?

Posted by LeopardSkinPillBoxHat on Stack Overflow See other posts from Stack Overflow or by LeopardSkinPillBoxHat
Published on 2010-02-05T05:29:30Z Indexed on 2010/05/13 8:24 UTC
Read the original article Hit count: 224

An application I am working with is exhibiting the following behaviour:

  1. During a particular high-memory operation, the memory usage of the process under Task Manager (Mem Usage stat) reaches a peak of approximately 2.5GB (Note: A registry key has been set to allow this, as usually there is a maximum of 2GB for a process under 32-bit Windows)

  2. After the operation is complete, the process size slowly starts decreasing at a rate of 1MB per second.

I am trying to figure out the easiest way to quickly determine who is freeing this memory, and where it is being free'd.

I am having trouble attaching a memory profiler to my code, and I don't particularly want to override the new/delete operators to track the allocations/deallocations (IOW, I want to do this without re-compiling my code).

Can anyone offer any useful suggestions of how I could do this via the Visual Studio debugger?


Update

I should also mention that it's a multi-threaded application, so pausing the application and analysing the call stack through the debugger is not the most desirable option. I considered freezing different threads one at a time to see if the memory stops reducing, but I'm fairly certain this will cause the application to crash.

© Stack Overflow or respective owner

Related posts about c++

Related posts about Windows