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.