Debugging heap corruption

If you have a heap corruption bug, use a heap monitor to debug it. Although the heap analyzer also notifies you of heap corruption, it does not help you pinpoint the problem. The heap monitor shows the pattern of allocations and deletions leading up to the corruption.

In order to debug the corruption, examine the event before the corruption message. If the message that the heap is corrupt occurs before any other events, you must start monitoring earlier. Starting with the code indicated by the preceding event's stack crawl, trace forward until you find the corruption. You can either read the source code or step through it with a debugger. The bug will usually involve violating array boundaries or misusing pointers. If you see another heap event (allocation or deletion), back up; you have gone too far.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker