Contents

isEnabled

Returns a Boolean value that indicates whether garbage collection is currently enabled for the current process.

Declaration

- (BOOL) isEnabled;

Return Value

true if garbage collection is enabled for the current process, otherwise false.

Discussion

This method returns false if garbage collection is on, but has been temporarily suspended (using disable).

To check whether the current process is using garbage collection check the result of [NSGarbageCollector defaultCollector]. If defaultCollector is nil, then garbage collection is permanently off. If defaultCollector is not nil, then the current process is using garbage collection—you can then use isEnabled to determine whether or not the collector is actually allowed to run right now.

See Also

Collection State