FireSync API
 All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kHeapAlloc.h
Go to the documentation of this file.
1 
8 #ifndef K_FIRESYNC_HEAP_ALLOC_H
9 #define K_FIRESYNC_HEAP_ALLOC_H
10 
11 #include <kFireSync/kFsDef.h>
12 
28 // typedef kObject kHeapAlloc; --forward - declared in kFsDef.x.h
29 
41 typedef kStatus(kCall* kHeapAllocExhaustionFx)(kHeapAlloc heapAlloc, kPointer receiver, kSize minimumRegionSize);
42 
50 {
52 
55 
58 
60 };
61 
70 kFsFx(kStatus) kHeapAlloc_Construct(kHeapAlloc* heapAlloc, kAlloc allocator);
71 
84 kFsFx(kStatus) kHeapAlloc_AddMemoryRegion(kHeapAlloc heapAlloc, kPointer address, kSize size);
85 
96 
106 kFsFx(kStatus) kHeapAlloc_Clear(kHeapAlloc heapAlloc);
107 
118 kFsFx(kStatus) kHeapAlloc_Stats(kHeapAlloc heapAlloc, kHeapAllocStats* stats);
119 
133 
134 #include <kFireSync/Utils/kHeapAlloc.x.h>
135 
136 #endif
Structure for statistics calculated by kHeapAlloc_Stats()-function.
Definition: kHeapAlloc.h:49
kSize freeBlocksCount
Number of free blocks available for allocations.
Definition: kHeapAlloc.h:56
kSize freeBytesCount
Number of bytes in all free blocks.
Definition: kHeapAlloc.h:57
kSize memoryRegionsCount
Number of memory regions added.
Definition: kHeapAlloc.h:51
kSize allocatedBytesCount
Number of bytes in all allocated memory blocks.
Definition: kHeapAlloc.h:54
kSize allocatedBlocksCount
Number of memory blocks allocated.
Definition: kHeapAlloc.h:53
kStatus kHeapAlloc_AddMemoryRegion(kHeapAlloc heapAlloc, kPointer address, kSize size)
Adds a pre-allocated memory region for use of the kHeapAlloc-object.
kStatus(kCall * kHeapAllocExhaustionFx)(kHeapAlloc heapAlloc, kPointer receiver, kSize minimumRegionSize)
Signature of callback to notify about heap exhaustion.
Definition: kHeapAlloc.h:41
kSize maxFreeBlockSize
The largest free block available for allocation.
Definition: kHeapAlloc.h:59
Essential API declarations for the kFireSync library.
kStatus kHeapAlloc_RemoveMemoryRegions(kHeapAlloc heapAlloc)
Removes all added memory regions including allocated blocks.
kStatus kHeapAlloc_Stats(kHeapAlloc heapAlloc, kHeapAllocStats *stats)
Reports used and free blocks from all added memory regions.
Allocates memory from user-defined memory regions.
kStatus kHeapAlloc_Construct(kHeapAlloc *heapAlloc, kAlloc allocator)
Constructs a new kHeapAlloc instance.
kStatus kHeapAlloc_AddExhaustionHandler(kHeapAlloc heapAlloc, kHeapAllocExhaustionFx callback, kPointer receiver)
Adds a callback that will be invoked upon memory exhaustion.
kStatus kHeapAlloc_Clear(kHeapAlloc heapAlloc)
Removes all allocated blocks but leaves the existing memory regions in place.