Function

CFRetain

Retains a Core Foundation object.

Declaration

CFTypeRef CFRetain(CFTypeRef cf);

Parameters

cf

The CFType object to retain. This value must not be NULL

Return Value

The input value, cf.

Discussion

You should retain a Core Foundation object when you receive it from elsewhere (that is, you did not create or copy it) and you want it to persist. If you retain a Core Foundation object you are responsible for releasing it (see Memory Management Programming Guide for Core Foundation).

Special Considerations

If cf is NULL, this will cause a runtime error and your application will crash.

See Also

Memory Management

CFGetAllocator

Returns the allocator used to allocate a Core Foundation object.

CFGetRetainCount

Returns the reference count of a Core Foundation object.

CFMakeCollectable

Makes a newly-allocated Core Foundation object eligible for garbage collection.

CFRelease

Releases a Core Foundation object.

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