After a program deallocates memory, it is quite possible that a pointer still points into the deallocated block. If the program uses that pointer to access information in this block, this data can be corrupt. Having MemoryScape hold on to deallocated blocks for awhile helps to keep this data correct. Holding on to deallocated blocks is called
hoarding. By retaining this memory, you reduce program failures. More importantly, because the program continues executing, additional and often related memory errors occur—errors that can help you diagnose the problem.
Enable hoarding either by selecting a level of Extreme or by selecting the check box in the
Advanced screen.
Figure 51 shows the portion of that screen that controls hoarding.
These controls let you set the number of blocks to be hoarded and the size of the hoard. Whenever you see this part of the screen, you’ll also see the size of the hoard and how many blocks are in it.
Hoarding deallocated memory may increase the risk of running out of available memory sooner than expected because deallocated memory is not released back to the heap manager. Reduce this risk by automatically releasing the hoarded memory when available memory gets low. You can also receive an event alerting you when the hoard size drops below the defined threshold. At that point, you know your program is getting close to running out of memory.