The numbers in curly braces like {657} give you a hint where and when it happens. These are the allocation request numbers. So every single allocation gets a new number and by this number you can track things.
If you can reproduce the memory leak in DEBUG mode and the leaks occur always with the same request numbers you can use the following technique:
- set a breakpoint in
dbgheap.c
in function
_heap_alloc_dbg
on the line that says:
lRequest = _lRequestCurr;
Instead of looking for that file in your VC++ installation you can equally well set a breakpoint an arbitrary
new
statement and drill down with step-into until you arrive at function _heap_alloc_dbg. Then find the above line and set a breakpoint there.
- make this a conditional breakpoint that only triggers for the request number you are looking for
- run your program; hopefully you will land on your breakpoint
- look at the call stack and find out what actually initiated this memory allocation request
It's not a really easy technique, but very helpful in some of the hard cases.