Detecting Memory Corruption
You can detect memory block overrun and underrun errors with either guard blocks or Red Zones.
Guard Blocks:
Use guard blocks to detect writing beyond the limits of a memory block. To turn them on, either
Select
Medium from Basic Memory Debugging Options, or
Select
Guard allocated memory from Advanced Memory Debugging Options.
With guards on, MemoryScape adds a small segment of memory before and after each block that you allocate. You can find corrupted memory blocks in two ways:
When the program frees the memory, the guards are checked for corruption. If a corrupted guard is found, MemoryScape stops program execution and raises an event flag. Click on the event flag to see the event details.
Select Corrupted Memory Report from the Memory Reports page.
Red Zones:
Use Red Zones to find both read and write memory access violations, notifying you immediately if your program oversteps the bounds of your allocated block.
To turn them on, either
Select
High from Basic Memory Debugging Options, or
Select
Use Red Zones to find memory access violations from Advanced Memory Debugging Options.
With Red Zones on, a page of memory is placed either before or after your allocated block, and if your program tries to read or write in this zone, MemoryScape stops program execution and raises an event flag. Click on the event flag to see the event details.
The default is to check for overruns, but you can check for underruns using Advanced Options controls.
See More