summaryrefslogtreecommitdiff
path: root/docs/application/pool.md
blob: f9baac640b1644e5134bfe6bdc46008aa07b186f (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
# Memory Pool

---

## Object Definitions

```c
#define POOL_HEADER(STRUCT) struct STRUCT *prev, *next; uint32_t obj_size

typedef struct _kpl_pool_obj {
    POOL_HEADER(_kpl_pool_obj);
} kpl_pool_obj;

typedef strut {
    _Atomic size_t allocs;
    kpl_pool_obj *root;
    pthread_mutex_t mutex;
} kpl_pool;

static kpl_pool_obj *kpl_pool_head;
```

## Object Size

The max size of an object in the pool is 2 \*\* 32

This allows for 4 aligned bytes after the `POOL_HEADER` macro

## List Management

## Tree Management