Using NuMega SoftICE

Where is the memory block you just allocated with Win32 API HeapAlloc()?

When you allocate a block of memory, it is allocated from one of the heap memory blocks that belong to the process address space of your program. You can use SoftICE "HEAP" command with '32' option to dump all of the heaps. If you specify the process name, it lists only heaps which is part of that process.

Each heap is identified by a linear address value where the heap is located at. "HEAP 32" command with "-w" switch followed by heap id (linear address) shows you the detail of the heap.

The figure below shows you how a block of memory allocated by HeapAlloc is managed by a heap.

Compile the program and try to see it with SoftICE.

Note - It appears that Visual C++'s C run-time library memory allocation functions (e.g. alloc, calloc, malloc) do not use system provided heap. Instead, it seems to implement its own heap. This is probably how it detects some heap-related errors such as memory leak. For this reason, you won't see malloc'ed memory with SoftICE "HEAP" command.


 contact guestbook | control panel 
1998-2000 Tsuyoshi Watanabe. All rights reserved.