CFAllocatorGetPreferredSizeForSize

Header: CFBase.h Carbon status: Supported

Obtains the number of bytes likely to be allocated upon a specific request.

CFIndex CFAllocatorGetPreferredSizeForSize (
    CFAllocatorRef allocator, 
    CFIndex size, 
    CFOptionFlags hint
);
Parameter descriptions
allocator

A value of reference type CFAllocatorRef. Pass a reference to a valid allocator or NULL to request the default allocator.

size

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.

hint

A bitfield of type CFOptionsFlags. Pass flags to the allocator that suggest how memory is to be allocated. Zero indicates no hints.

function result

An integer value of type CFIndex representing the number of bytes likely to be allocated upon a specific request.

DISCUSSION

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.

AVAILABILITY

Supported in Carbon. Available in Carbon 1.0.2 and later.


© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)