|
FireSync API
|
Allocates memory from user-defined memory regions.
This memory allocator is useful when the pre-allocated memory regions are needed to use for dynamic memory allocations. kAlloc_Get/kAlloc_Free functions shall be used for allocations.
Allocated blocks can all be freed at once by discarding the entire kHeapAlloc object without calling kAlloc_Free function for each block separately.
All public functions are thread-safe. kAlloc_Get/kAlloc_Free functions have O(log n) time complexity, where n is number of free blocks in regions.

Public Types | |
| typedef kStatus(kCall * | kHeapAllocExhaustionFx )(kHeapAlloc heapAlloc, kPointer receiver, kSize minimumRegionSize) |
| Signature of callback to notify about heap exhaustion. More... | |
Public Member Functions | |
| kStatus | kHeapAlloc_AddExhaustionHandler (kHeapAlloc heapAlloc, kHeapAllocExhaustionFx callback, kPointer receiver) |
| Adds a callback that will be invoked upon memory exhaustion. More... | |
| kStatus | kHeapAlloc_AddMemoryRegion (kHeapAlloc heapAlloc, kPointer address, kSize size) |
| Adds a pre-allocated memory region for use of the kHeapAlloc-object. More... | |
| kStatus | kHeapAlloc_Clear (kHeapAlloc heapAlloc) |
| Removes all allocated blocks but leaves the existing memory regions in place. More... | |
| kStatus | kHeapAlloc_Construct (kHeapAlloc *heapAlloc, kAlloc allocator) |
| Constructs a new kHeapAlloc instance. More... | |
| kStatus | kHeapAlloc_RemoveMemoryRegions (kHeapAlloc heapAlloc) |
| Removes all added memory regions including allocated blocks. More... | |
| kStatus | kHeapAlloc_Stats (kHeapAlloc heapAlloc, kHeapAllocStats *stats) |
| Reports used and free blocks from all added memory regions. More... | |