Go to the first, previous, next, last section, table of contents.


The NSAllocDebugZone class

The NSDefaultZone uses system malloc, calloc, realloc and free directly, without any checks.

The NSAllocDebugZone is used to help in tracking down memory allocation bugs. It provides the following features:

The NSAllocDebugZone is controlled by the following environment variables:

The NSAllocDebugZone provides these functions to be used from the GNU debugger.

The program instantiates two zones: one NSDefaultZone and one NSAllocDebugZone, and uses one or the other depending on the ALLOCDEBUG environment variable. If this variable exists in your environment then the NSAllocDebugZone instance will be used.

Below are some setting you might find useful when working with the NSAllocDebugZone class.

# must be set to something to use alloc debug zone
ALLOCDEBUG=YES
export ALLOCDEBUG=YES

# stop in debugger (SIGINT) when alloc-ing pointer number *
# nil or 0 means no stop
ALLOCDEBUG_STOP=0
export ALLOCDEBUG_STOP

# stop in debugger (SIGINT) when alloc-ing pointer number *
# nil or 0 means no stop
ALLOCDEBUG_MARK=0
export ALLOCDEBUG_MARK

# number of passes inside allocation/deallocation functions
# to SYSTEM_MALLOC_CHECK and internal check
# nil or 0 means no checks
ALLOCDEBUG_COUNT=16
export ALLOCDEBUG_COUNT

# number of bytes to alloc at top/bottom of object block
# these bytes are set to a given value (0x88) and checked
# at free and internal check to guard against using memory
# past the limit.
ALLOCDEBUG_UPPER=8
ALLOCDEBUG_LOWER=8
export ALLOCDEBUG_UPPER ALLOCDEBUG_LOWER


Go to the first, previous, next, last section, table of contents.