Make process crash on large memory allocation
Posted
by Pieter
on Stack Overflow
See other posts from Stack Overflow
or by Pieter
Published on 2010-04-12T17:01:09Z
Indexed on
2010/04/12
17:02 UTC
Read the original article
Hit count: 324
I'm trying to find a significant memory leak (15MB at a time, but doing allocations like this on multiple places). I checked the most obvious places, and then used AQTime, but I still can't pinpoint it. Now I see 2 options left:
1) Use SetProcessWorkingSetSize: I've tried this but my process happily keeps on running when using up more then 150MB:
DWORD MemorySize = 150*1024*1024;
SetProcessWorkingSetSize( GetCurrentProcess(), MemorySize/2, MemorySize*2 );
2) Put a breakpoint when allocating more then 1MB at a time. How should I do this, overload operator new with an 'if>1MB' inside ?
© Stack Overflow or respective owner