release(int)

Releases a reference to an object, freeing it immediately if the reference count drops below the specified threshold.

Declaration

virtual void release(
 intfreeWhen) const; 

Parameters

freeWhen

If decrementing the reference count makes it >= freeWhen, the object is immediately freed.

Overview

If the receiver has freeWhen or fewer references after its reference count is decremented, it is immediately freed.

This version of release can be used to break certain retain cycles in object graphs. In general, however, it should be avoided.

See Also

Miscellaneous

- free

Deallocates/releases resources held by the object.

- getRetainCount

Returns the reference count of the object.

- init

Initializes a newly-allocated object.

- operator delete

Frees the memory of the object itself.

- operator new

Allocates memory for an instance of the class.

- release()

Releases a reference to the object, freeing it immediately if the reference count drops to zero.

- retain

Retains a reference to the object.

- serialize

Overridden by subclasses to archive the receiver into the provided OSSerialize object.

- taggedRelease(const void *)

Releases a tagged reference to an object, freeing it immediately if the reference count drops to zero.

- taggedRelease(const void *, const int)

Releases a tagged reference to an object, freeing it immediately if the reference count drops below the specified threshold.

- taggedRetain

Retains a reference to the object with an optional tag used for reference-tracking.