Jan 15, 2009

What is Heap Corruption? How do you know if a program has Heap Corruption? How do you debug it?

What is Heap Corruption?
How do you know if a program has Heap Corruption?
How do you debug it?
Heap corruption occurs when the heap's bookkeeping data--such as which parts of memory are allocated and which are free for new allocations--are corrupted. This usually occurs from incorrect use of memory allocation functions. After heap corruption, undefined behaviour occurs; the program may appear to work correctly to start with, but might fail on the next run, or when recompiled, or at any other time.
Releasing a resource twice
Lack of copy constructor and/or copy assignment operator
Improper Handling of Pointers
Overrunning storage
Stack Overflow
Valgrind -- free Linux tool to help debug memory allocation issues
IBM Rational Purify -- commercial Unix and Windows tool
http://www.efnetcpp.org/wiki/Heap_Corruption

No comments:

Post a Comment