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.