Debugging Memory Problems with MemoryScape : Chapter 1 Locating Memory Problems : Hoarding : Example 1: Finding a Multithreading Problem

Example 1: Finding a Multithreading Problem
When a multithreaded program shares memory, problems can occur if one thread deallocated a memory block while another thread is still using it. Because threads execute intermittently, problems are also intermittent. If you hoard memory, the memory will stay viable for longer because it cannot be reused immediately.
If intermittent program failures stop occurring, you know what kind of problem exists.
One advantage of this technique is that you can relink your program (as is described in Chapter 4, “Creating Programs for Memory Debugging”) and then run MemoryScape against a production program that was not compiled using the –g compiler debugging option. If you see instances of the hoarded memory, you’ll instantly know problems have occurred.
This technique often requires that you increase the number of blocks being hoarded and the hoard size.

Rogue Wave Software, Inc.
Voice: (303) 473-9118
rwonlinedocs@roguewave.com