1.3 Memory Management
In anticipation of the day when we can make the use of a Garbage Collector
possible for all GNUstep apps (it's almost-usable/usable-with-care for
non-gui apps now), the normal use of retain/release/autorelease is
You should always use the macros RETAIN(), RELEASE() and AUTORELEASE()
(defined in NSObject.h) instead.
There are also some extra macros that may be of use -
ASSIGN(object,value) to assign an object variable, performing the appropriate retain/release as necessary.
ASSIGNCOPY(object,value) to copy the value and assign it to the object.
DESTROY(object) to release an object variable and set it to nil.
TEST_RETAIN(object) to retain an object if it is non-nil
TEST_RELEASE(object) to release an object if it is non-nil
TEST_AUTORELEASE(object) to autorelease an object if it is non-nil
CREATE_AUTORELEASE_POOL(name) to create an autorelease pool with the
- IF_NO_GC(X) compile the code 'X' only if GarbageCollection is not
This document was generated
by Adam Fedor on January, 1 2008