blob: e180b2468088aa44207c81f3fc7a7a2c7fc837a1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# Memory
---
An allocator per Object definition with ring buffer pooling based
# Single Allocation
Once created never freed until shutdown
# Pooling Allocations
## Ring Buffer
## Fixed Sized Objects
## Dynamic Sized Objects
Dynamically sized objects must be aligned to a power of two
Requires a ring buffer for each power of two
## Object Definitions
```c
#define KPL_DYANMIC_OBJ_MIN_BITS 7
#define KPL_DYNAMIC_OBJ_MAX_BITS 30
#define KPL_DYNAMIC_OBJ_MIN_SIZE (1 << KPL_DYANMIC_OBJ_MIN_BITS)
#define KPL_DYNAMIC_OBJ_MAX_SIZE (1 << KPL_DYNAMIC_OBJ_MAX_BITS)
#define KPL_DYNAMIC_OBJ_HEADER() int32_t obj_size;
typedef struct {
KPL_DYNAMIC_OBJ_HEADER();
} kpl_dynamic_obj;
```
|