brmem_allocate_cbfn
allocate
member of the br_allocator
99
structure.
typedef
brmem.h
for a precise declaration)
void * brmem_allocate_cbfn(br_size_t,br_uint_8) Allocator
Size in bytes of memory block required. More bytes may be allocated, but the caller will only use the first
Class (type ID) of memory required. Although it is possible for the class to be ignored, it may be used for diagnostic purposes, or could be used to provide a more efficient allocation scheme. See Memory Classes for a description of possible values.
Specification
Description:
An application defined call-back function returning a pointer to newly allocated memory of specified size and type.CBFnMemAllocate()
void* BR_CALLBACK CBFnMemAllocate(br_size_t size, br_uint_8 type)
br_size_t size
size
bytes. Zero is a valid value.br_uint_8 type
BrDiagHandlerSet()
116). BRender has not necessarily completed initialisation. This may not be the first allocator to have been called. BRender is the only direct caller of this function.
Effects: Obtain a fixed, contiguous, persistent, readable, writable, non-volatile area of memory of at least the size specified (even if zero), that will remain so until a corresponding call of
CBFnMemFree()
385
has occurred.Result:
void *
The address of a block of memory of the required size. If the request cannot be satisfied, return Null
.
No assumption can be made concerning any relation between the address returned by this call and any previous or subsequent call.
Remarks: Although BRender's default diagnostic handling system does not use the memory handler, if you supply a diagnostic handler that does, you may have to handle memory allocation failures directly.
The value returned by CBFnMemInquire()
386 does not guarantee the subsequent success or failure of
CBFnMemAllocate()
383.
Example: See
stdmem.c
for examples of memory allocation functions.See Also:
CBFnMemFree()
385
, CBFnMemInquire()
386
.