CFGetAllocatorHeader: CFBase.h

Obtains the allocator used to allocate a Core Foundation object.

CFAllocatorRef CFGetAllocator (
    CFTypeRef cf
);
cf

A generic reference of type CFTypeRef. Pass a reference to a Core Foundation object whose allocator you wish to obtain.

function result

A value of reference type CFAllocatorRef that refers to an allocator object.

DISCUSSION

When you are creating a Core Foundation object sometimes you want to ensure that the block of memory allocated for the object is from the same allocator used for another object. One way to do this is to reuse the allocator assigned to an existing Core Foundation object when you call a Core Foundation "creation" function. The CFGetAllocator function gives you a reference to this allocator.


© 1999 Apple Computer, Inc. — (Last Updated 9/15/99)