Guarding Memory Blocks: dheap -guards
When your program allocates a memory block, MemoryScape can surround this block with additional memory. It will also initialize this memory to a bit pattern. When MemoryScape checks these blocks, it can tell if your program overwrote the blocks.
Checks can be made in the following ways:
Use the
dheap -guard -check command while the process is stopped. MemoryScape will respond by writing information about all overwritten guard blocks.
Use the
dheap -notify command. If you’ve turned on notification, MemoryScape checks guard blocks when your program deallocates a memory block. If that memory block’s guards were altered, the CLI stops program execution and MemoryScape writes information.
| You should set the TotalView VERBOSE setting to WARNING. Setting it lower than this suppresses this output. Setting it higher tends to bury the information in debugger runtime information. |
Use the dheap -guard -set command to turn this feature on or off. To see guard block status, use the dheap -guard command without an argument. For example:
d1.<> dheap -guard
Size Pattern
process: Enabled Max Pre Post Pre Post
1 (13071): yes 0 8 8 0x77777777 0x99999999
If you are using the dheap -info command, you can include guard block information in the output by typing dheap -info -show_guard_settings.