< Previous PageNext Page > Hide TOC

Using Allocators in Creation Functions

Each Core Foundation opaque type has one or more creation functions, functions that create and return an object of that type initialized in a particular way. All creation functions take as their first parameter a reference to an allocator object (CFAllocatorRef). Some functions may also have allocator parameters for specialized allocation and deallocation purposes.

You have several options for the allocator-reference parameters:

If you are to use a custom allocator and you want to make it the default allocator, it is advisable to first get a reference to the current default allocator using the CFAllocatorGetDefault function and store that in a local variable. When you are finished using your custom allocator, use the CFAllocatorSetDefault function to reset the stored allocator as the default allocator.



< Previous PageNext Page > Hide TOC


© 2008 Apple Inc. All Rights Reserved. (Last updated: 2008-10-15)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.