Dangling Pointer Problems
Fixing dangling pointer problems is usually more difficult than fixing other memory problems. First of all, you become aware of them only when you realize that the information your program is manipulating isn’t what it is supposed to be. Even more troubling, these problems can be intermittent, happening only when your program’s heap manager reuses a memory block. For example, if nothing else is running on your computer, your program may never reuse the block. If there are a large number of jobs running, it could reuse a deallocated block quickly.
After you identify that you have a dangling pointer problem, you have two problems to solve. The first is to determine where your program freed the memory block. The second is to determine where it should free this memory.
When memory debugging is enabled, TotalView identifies dangling pointers in the Local Variable view and the Data View. You can also tag specific memory blocks so you are notified when memory is allocated or freed. See
Memory Block Notification.