![]() |
CFAllocatorGetPreferredSizeForSize | Header: CFBase.h |
Obtains the number of bytes likely to be allocated upon a specific request.
CFIndex CFAllocatorGetPreferredSizeForSize ( CFAllocatorRef allocator, CFIndex size, CFOptionFlags hint );
A value of reference type CFAllocatorRef. Pass a reference to a valid allocator or NULL to request the default allocator.
An integer value of type CFIndex. Pass the number of bytes you want to be allocated. If the value of size is zero or less, the result is the same value.
A bitfield of type CFOptionsFlags. Pass flags to the allocator that suggest how memory is to be allocated. Zero indicates no hints.
An integer value of type CFIndex representing the number of bytes likely to be allocated upon a specific request.
You use the CFAllocatorGetPreferredSizeForSize to find out the number of bytes likely to be allocated upon a specific request. This result depends on the allocator's internal allocation strategy, and will be equal to or larger than size. Calling this function may help you better match your memory allocation or reallocation strategy to that of the allocator.
Note that the return value depends on the internal implementation of the allocator and the results may change from release to release or from platform to platform.
If no function callback is assigned to the preferredSize field of the allocator's context (see the CFAllocatorContext structure), then the value of size is returned.