8.4. Garbage Collection
8.4 Garbage Collection
This section is specific for the GNU Objective-C runtime. If you are using a different runtime, you can skip it.
Support for garbage collection with the GNU runtime has been added by using a powerful conservative garbage collector, known as the Boehm-Demers-Weiser conservative garbage collector.
To enable the support for it you have to configure the compiler using an additional argument, --enable-objc-gc
. This will build the boehm-gc library, and build an additional runtime library which has several enhancements to support the garbage collector. The new library has a new name, libobjc_gc.a
to not conflict with the non-garbage-collected library.
When the garbage collector is used, the objects are allocated using the so-called typed memory allocation mechanism available in the Boehm-Demers-Weiser collector. This mode requires precise information on where pointers a