br_allocator
typedef
brmem.h
for precise declaration and ordering)
brmem_allocate_cbfn * allocate Memory allocation function
brmem_free_cbfn * free Memory deallocation function
brmem_inquire_cbfn * inquire Memory inquiry function
char * identifier Allocator name
Members
Handling Functions
This is a pointer to the memory allocation function (See brmem_allocate_cbfn * allocate
brmem_allocate_cbfn
383). This is called by
BrMemAllocate()
55
brmem_free_cbfn * free
brmem_free_cbfn
385
). This is called by BrMemFree()
56
.
brmem_inquire_cbfn * inquire
brmem_inquire_cbfn
386
). This is called by BrMemInquire()
55
.
char * identifier
Null
if not required). A string constant is recommended.
Operations
Description:
Install a new set of memory allocation/deallocation functions.BrAllocatorSet()
const br_allocator* BrAllocatorSet(const br_allocator* newal)
const br_allocator * newal
structure.
Result:
const br_allocator *
Returns a pointer to the old br_allocator
99 structure.
identifier
has been allocated from the heap.
Access & Maintenance
While the structure is the current allocator (most recently passed to BrAllocatorSet()
100) the members should not be changed. No maintenance required.
Referencing & Lifetime
The structure must remain valid until a new allocator is passed to BrAllocatorSet()
100.
Initialisation
The members should be set before the structure is passed to BrAllocatorSet()
100.
If constructed by `
Construction & Destruction
The structure should ideally be statically constructed.malloc
' ensure it is destroyed by `free
', i.e. the memory allocation handler that provided the storage should be the one to reclaim it. Be careful if macros have been used to redefine malloc
to use BRender's allocator. Generally, be aware of any constraints one handler may place on memory allocated by another handler. Supplementary
The identifier
may be used to determine the current handler in use.
Generated with CERN WebMaker