Debugging Memory Problems with MemoryScape™ : Chapter 5 MemoryScape Scripting : event_action Command-Line Option
event_action Command-Line Option
The -event_action command-line option is the most complex of the command line options. Its format is as follows:
-event_actionevent=action list
Specifies one or more actions that the script should perform if an event occurs. The “event=action list” consists of comma-separated set event=action pairs. For example:
"alloc_null=save_memory_debugging_file, \
dealloc_notification=list_allocations"
event can be:
Event
Description
addr_not_at_start
A block is being freed, and the address is not at the beginning of the block.
alloc_not_in_heap
The block being freed is not in the heap.
alloc_null
The malloc() function returned a null block.
alloc_returned_bad_alignment
The block is misaligned.
any_memory_event
All memory notification events.
bad_alignment_­argument
The block returned by the malloc library is not aligned on a byte boundary required by your operating system. The heap may be corrupted. (This is not a program error.)
double_alloc
Allocator returned a block already in use. The heap may be corrupted.
double_dealloc
Program is attempting to free a block already freed.
free_not_allocated
Program is attempting to free a block that was not allocated.
guard_corruption
Guard corruption was detected when program deallocated a block.
hoard_low_memory_threshold
Hoard low memory threshold is crossed.
realloc_not_­allocated
Program attempted to reallocate a block that was not allocated.
rz_overrun
Program attempted to access memory beyond end of allocated block.
rz_underrun
Program attempted to access memory before start of allocated block.
rz_use_after_free
Program attempted to access block after it was deallocated.
rz_use_after_free_overrun
Program attempted to access memory beyond end of deallocated block.
rz_use_after_free_underrun
Program attempted to access memory before start of deallocated block.
termination_­notification
Program is about to execute its _exit routine.
action is as follows:
Action
Description
check_guard_blocks
Check for guard blocks and generate a corruption list.
list_allocations
Create a list of all your program’s allocations.
list_leaks
Create a list of all of your program’s leaks.
save_html_heap_­status_source_­view
Save the Heap Status Source report as an HTML file.
save_memory_­debugging_file
Save a memory debugging file; you can reload this file at a later time.
save_text_heap_status_source_­view
Save the Heap Status Source report as a text file.