Debugging Memory Problems with MemoryScape : Chapter 1 Locating Memory Problems : Block Painting

Block Painting
Your program should initialize memory before it is used, and it should never use memory that is deallocated. MemoryScape can help you identify these kinds of problems by writing a bit pattern into memory as it is allocated or deallocated. You can either specify a pattern or use the default, as follows:
*
The default allocation pattern is 0xa110ca7f, which was chosen because it resembles the word “allocate”.
*
The default deallocation pattern is 0xdea110cf, which was chosen because it resembles the word “deallocate”. In most cases, you want MemoryScape to paint memory blocks when your program allocates them.
 
If your program displays this value, you’ll be able to tell what the problem is. In some cases, using these values will cause your program to crash. Because MemoryScape traps this action, you can investigate the cause of the problem.
You can turn painting on and off without restarting your program. If, for example, you change the deallocation pattern, you’ll have a better idea when your program deallocated the block. That is, because MemoryScape is using a different pattern after you change it, you will know if your program allocated or deallocated the memory block before or after you made the change.
If you are painting deallocated memory, you could be transforming a working program into one that no longer works. This is good, as MemoryScape will be telling you about a problem.

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