Instance Method

retainCount

Do not use this method.

Required.

Declaration

- (NSUInteger)retainCount;

Return Value

The receiver’s reference count.

Discussion

This method is of no value in debugging memory management issues. Because any number of framework objects may have retained an object in order to hold references to it, while at the same time autorelease pools may be holding any number of deferred releases on an object, it is very unlikely that you can get useful information from this method.

To understand the fundamental rules of memory management that you must abide by, read Memory Management Policy. To diagnose memory management problems, use a suitable tool:

  • The Clang Static analyzer can typically find memory management problems even before you run your program.

  • The Object Alloc instrument in the Instruments application (see Instruments User Guide) can track object allocation and destruction.

See Also

Obsolete Methods

- retain

Increments the receiver’s reference count.

Required.

- release

Decrements the receiver’s reference count.

Required.

- autorelease

Decrements the receiver’s retain count at the end of the current autorelease pool block.

Required.

- zone

Zones are deprecated and ignored by most classes that have it as a parameter.

Required.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software