When your program allocates or deallocates a block, MemoryScape can paint the block with a bit pattern. This makes it easy to identify uninitialized blocks, or blocks pointed to by dangling pointers.
Use the dheap –paint command to check the kind of painting that occurs and what the current painting pattern is. For example:
Some heap allocation routines such as calloc() return memory initialized to zero. Using the
–set_zalloc_on command allows you to separately enable the painting of the memory blocks altered by these kinds of routines. If you do enable painting for routines that set memory to zero, MemoryScape uses the same pattern that it uses for a normal allocation.
The 0xall0ca7f allocation pattern resembles the word “allocate”. Similarly, the
0xdea110cf deallocation pattern resembles “deallocate”.
Notice that all of the values in the red_balls structure in this example aren’t set to
0xall0ca7f. This is because the amount of memory used by elements of the variable use more bits than the
0xall0ca7f bit pattern. The following two CLI statements show the result of printing the
x variable, and then casting it into an array of two integers: