Debugging Memory Problems with MemoryScape™ : Chapter 5 MemoryScape Scripting : Other Command Line Options
Other Command Line Options
The memscript command takes these additional options.
-guard_blocks
Turn on guard blocks.
-red_zones_overruns
Turn on testing for Red Zone overruns.
-red_zones_underruns
Turn on testing for Red Zone underruns.
-detect_use_after_free
Turn on testing for use after memory is freed.
-hoard_freed_memory
Turn on the hoarding of freed memory.
-hoard_low_memory_threshold nnnn
Specify the low memory threshold that will generate an event.
-detect_leaks
Turn on leak detection.
-red_zones_size_ranges min:max,min:max,...
Specify the memory allocation ranges for which Red Zones are in effect. Ranges can be in the following formats:
x:y allocations from x to y
:y allocations from 1 to y
x: allocations of x and higher
x allocation of x
-maxruntime hh:mm:ss
Specify the maximum amount of time the script should run where:
hh: number hours
mm: number of minutes
ss: number of seconds
As a script begins running, MemoryScape adds information to the beginning of the log file. This information includes time stamps for both the file when processes start, the name of the program, and so on.
memscript Example
The example here performs these actions:
Runs the filterapp program under MemoryScape control.
Passes an argument of 2 to the filterapp program.
Whenever any event occurs—an HIA event, SEGV, and the like—saves a memory debugging file.
Allows the script to run for no longer than 5 seconds.
Performs the following activities: use guard blocks, hoard freed memory, and detect memory leaks.
memscript -maxruntime "00:00:05" \
-event_action "any_event=save_memory_debugging_file" \
-guard_blocks -hoard_freed_memory -detect_leaks \
~/Work/filterapp -a 2