BRender Technical Reference Manual:4 Data Structures (Alphabetical Reference):brmem_free_cbfn
Next|Prev|Up
The Call-Back Function
Specification
CBFnMemFree()

brmem_free_cbfn


The Call-Back Function

This type defines a memory deallocation function, primarily intended for the free member of the br_allocator
99 structure.

The typedef

(See brmem.h for a precise declaration)

void brmem_free_cbfn(void *) Deallocator

Specification


CBFnMemFree()

Description:
An application defined call-back function that will reclaim memory previously allocated by CBFnMemAllocate()
383.

Declaration:
void BR_CALLBACK CBFnMemFree(void* block)

Arguments:
void * block

Address of memory no longer required, previously returned by the corresponding CBFnMemAllocate()383 (with no intervening CBFnMemFree()385). Null is ignored.

Preconditions:
The diagnostic handler has been setup (BrDiagHandlerSet()116). BRender has not necessarily completed initialisation. Other allocation handlers may have already been used. BRender is the only direct caller of this function. The application has disposed of all references to the memory (obtained using the supplied address).

Effects:
Release supplied memory (presumably making it available for re-use).

If the supplied address is invalid (not recognised as previously allocated by the corresponding CBFnMemAllocate()383), consider this a failure condition and handle appropriately. Note that the BRender diagnostic handling system may not be available, or even capable of handling this condition.

Remarks:
The memory freed will not necessarily increase the value returned by CBFnMemInquire()386, though it is of course a hopeful effect.

The application should immediately set to Null all pointers referencing the memory freed, (at least in a debug version).

Example:
See stdmem.c for examples of memory deallocation functions.

See Also:
CBFnMemAllocate()383, CBFnMemInquire()386.



Generated with CERN WebMaker