Using Red Zones
 
* 
Red Zone controls appear on the toolbar only on platforms that support Red Zone capabilities. See the Platform Guide for specific platform support.
As discussed in Using Guard Blocks”, when a program allocates a memory block, it is responsible to not write or read data outside the block. Red Zones give you another tool, like guard blocks, for detecting access violations.
MemoryScape can immediately detect when your program oversteps the bounds of your allocated memory by protecting it with a Red Zone, a page of memory placed either before or after your allocated block. If your program tries to read or write in this Red Zone, MemoryScape halts the execution of your program and notifies you. When the Red Zone is placed before the block, MemoryScape detects underruns; conversely, if the Red Zone is placed after the block, it detects overruns. It can also detect if your program accesses the block after it has been freed.
Since your program halts when MemoryScape detects an overrun or underrun, you know exactly where it overstepped the bounds of the block. The event information shows the current stack trace, to allow you to pinpoint where the event occurred. It also shows where the corrupted block was allocated and deallocated, if appropriate.
Using Red Zones can significantly increase your program’s memory consumption, so MemoryScape provides ways to limit their use. You can turn them on and off at any time during your program’s execution using the Red Zone button on the toolbar. You can also restrict Red Zone use by size range, defining a range such that only block sizes within that range will be protected by Red Zones. You can use multiple ranges collectively to exclude allocations of a particular size.
 
* 
For a detailed description of how Red Zones work, see “Red Zones Bounds Checking: dheap -red_zones”.