ftp.nice.ch/Attic/openStep/implementation/gnustep/sources/libFoundation.0.7.tgz#/libFoundation-0.7/libFoundation/doc/NSZone.txt

This is NSZone.txt in view mode; [Download] [Up]

NSZone implementation details
    NSZone is a class instead of a struct, and its related functions are
    mapped to methods in "static inline" functions.

    The idea behind the definition of the NSZone as a class with methods and
    not as a struct and functions is to offer the user of the library the
    possibility to build his own allocator and to let current and future
    allocators coexist.

    Currently only two zone types are available: NSDefaultZone and
    NSAllocDebugZone, though they can be used only through the NSZone class
    and not directly. The future plan is to make them available to the user
    directly.

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

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

    *
    check double deallocation for pointers
    *
    check deallocation of non-existing pointers
    *
    use a block of memory past its margins
    *
    list blocks allocated since a moment (marked by a special call)
    *
    each allocated pointer has a serial number
    *
    stop when alloc-ing a pointer with a certain serial number
    *
    do SYSTEM_MALLOC_CHECK and internal checks every count operation
    *
    be able to control things from gdb
    *
    be able to control things from environment variables

    The NSAllocDebugZone is controlled by the following environment
    variables:

    ALLOCDEBUG
        must be set to something to use the alloc debug zone

    ALLOCDEBUG_STOP
        stop in debugger (SIGINT) when alloc-ing pointer with given serial
        number (this serial number is reported when and error with that
        pointer occurs). Undefined or 0 means no stop.

    ALLOCDEBUG_COUNT
        number of passes inside allocation/deallocation functions to
        SYSTEM_MALLOC_CHECK and internal check. Undefined or 0 means no
        checks.

    ALLOCDEBUG_UPPER
    ALLOCDEBUG_LOWER
        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. Undefined or
        zero means no margin. Note that this size must be multiples of the
        machine address alignment (4, 8, 16 are recommended values).


    The NSAllocDebugZone provides these functions to be used from debugger
    (gdb)

    debuggerStopMark(unsigned mark)
    overrides ALLOCDEBUG_STOP
    debuggerCheckTime(unsigned count)
    overrides ALLOCDEBUG_COUNT
    debuggerDescription(id obj)
    performs printf("%s\n", [obj description])
    debuggerPerform(id obj, char* sel)
    performs [obj sel]
    debuggerPerformWith(id obj, char* sel, id arg)
    performs [obj sel:(id)atoi(arg)]

    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 is set to something
    then the NSAllocDebugZone instance will be used.

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.