You may wish to trace the history of a reallocated memory block.
The example program is used to examining where memory was allocated and reallocated.
This example is for the CRT, but the same techniques work for
•Win32 heaps
•GlobalAlloc() heaps
•LocalAlloc() heaps
•CoTaskMemAlloc()
•IMallocSpy
•user defined (custom allocators) heaps.

•Memory tab
Display...
ensure All Memory (leaks, errors, unleaked) is selected in the first combo box
launch nativeExample.exe
wait until attaching is complete
Allocations menu
C Runtime (C/C++) Heap
Reallocate memory...
shows the Test Memory dialog

Set the following to allocate a 10 bytes block and reallocate it twice, growing in size by 5 bytes each time.
•Number of bytes to allocate
set to 10
•Number of times to allocate
set to 2
•Reallocate
check this
•Reallocation increment
set to 5
OK

•Memory tab
Refresh
the display should refresh to include an item like the one below

•expand the item
shows the reallocation history - an allocation and two reallocations

•expand the topmost entry in the callstack
show the source code for the reallocation in CTeststakView::OnTestReallocatememory()
Note that the two reallocation locations are the same (because they are in a loop).


File menu
Exit