Instance Method

isEnabled

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

Declaration

- (BOOL)isEnabled;

Return Value

YES if garbage collection is enabled for the current process, otherwise NO.

Discussion

This method returns NO 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

disable

Temporarily disables collections.

Deprecated
enable

Enables collection after collection has been disabled.

Deprecated
isCollecting

Returns a Boolean value that indicates whether a collection is currently in progress.

Deprecated