Zen API
 All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kHeapAlloc.h
Go to the documentation of this file.
1 
8 #ifndef K_API_HEAP_ALLOC_H
9 #define K_API_HEAP_ALLOC_H
10 
11 #include <kApi/kApiDef.h>
12 
23 typedef kStatus(kCall* kHeapAllocExhaustionFx)(kHeapAlloc heapAlloc, kPointer receiver, kSize minimumRegionSize);
24 
32 {
34 
37 
40 
42 };
43 
66 // typedef kObject kHeapAlloc; --forward - declared in kFsDef.x.h
67 
68 
77 kFx(kStatus) kHeapAlloc_Construct(kHeapAlloc* heapAlloc, kAlloc allocator);
78 
91 kFx(kStatus) kHeapAlloc_AddMemoryRegion(kHeapAlloc heapAlloc, kPointer address, kSize size);
92 
104 
114 kFx(kStatus) kHeapAlloc_Clear(kHeapAlloc heapAlloc);
115 
126 kFx(kStatus) kHeapAlloc_Stats(kHeapAlloc heapAlloc, kHeapAllocStats* stats);
127 
141 
142 #endif
Structure for statistics calculated by the kHeapAlloc_Stats function.
Definition: kHeapAlloc.h:31
Represents a void pointer.
kSize freeBlocksCount
Number of free blocks available for allocations.
Definition: kHeapAlloc.h:38
kSize freeBytesCount
Number of bytes in all free blocks.
Definition: kHeapAlloc.h:39
kSize memoryRegionsCount
Number of memory regions added.
Definition: kHeapAlloc.h:33
kSize allocatedBytesCount
Number of bytes in all allocated memory blocks.
Definition: kHeapAlloc.h:36
Represents an unsigned integer that can store a pointer address.
Abstract base class for memory allocator types.
kSize allocatedBlocksCount
Number of memory blocks allocated.
Definition: kHeapAlloc.h:35
kStatus kHeapAlloc_AddMemoryRegion(kHeapAlloc heapAlloc, kPointer address, kSize size)
Adds a pre-allocated memory region for use of the kHeapAlloc object.
typedef kStatus(kCall *kMsgQueueDropFx)(kPointer receiver
Defines the signature of a callback function to handle dropped items.
kStatus(kCall * kHeapAllocExhaustionFx)(kHeapAlloc heapAlloc, kPointer receiver, kSize minimumRegionSize)
Signature of callback to notify about heap exhaustion.
Definition: kHeapAlloc.h:23
kSize maxFreeBlockSize
The largest free block available for allocation.
Definition: kHeapAlloc.h:41
Core Zen type declarations.
kStatus kHeapAlloc_RemoveMemoryRegions(kHeapAlloc heapAlloc)
Removes all added memory regions.
kStatus kHeapAlloc_Stats(kHeapAlloc heapAlloc, kHeapAllocStats *stats)
Reports used and free blocks from all added memory regions.
Allocates memory from user-defined memory regions.
Represents an error code.
kStatus kHeapAlloc_Construct(kHeapAlloc *heapAlloc, kAlloc allocator)
Constructs a new kHeapAlloc instance.
#define kCall
kApi standard function calling convention.
Definition: kApiDef.h:15
kStatus kHeapAlloc_AddExhaustionHandler(kHeapAlloc heapAlloc, kHeapAllocExhaustionFx callback, kPointer receiver)
Adds a callback that will be invoked upon memory exhaustion.
kStatus kHeapAlloc_Clear(kHeapAlloc heapAlloc)
Frees all memory allocations that have been made from this kHeapAlloc instance.