Update arena documentation
+3
-1
@@ -45,6 +45,8 @@ The commit flag behaviour varies by platform:
|
|||||||
|
|
||||||
A bump allocator backed by OS virtual memory (or a user-provided buffer). Provides fast sequential allocations with temporary scope support.
|
A bump allocator backed by OS virtual memory (or a user-provided buffer). Provides fast sequential allocations with temporary scope support.
|
||||||
|
|
||||||
|
> **Prefer the arena-backed Allocator** — The library provides `wapp_mem_arena_allocator_init` which wraps an arena in the `Allocator` interface. Using this over raw arena functions is recommended for most use cases, as it is compatible with all data structures in the base package (arrays, lists, queues, strings) and provides a consistent API.
|
||||||
|
|
||||||
### Initialization
|
### Initialization
|
||||||
|
|
||||||
| Function / Macro | Description |
|
| Function / Macro | Description |
|
||||||
@@ -107,7 +109,7 @@ Wraps an `Arena` in the `Allocator` interface from base.
|
|||||||
| `wapp_mem_arena_allocator_clear(allocator)` | Clear arena |
|
| `wapp_mem_arena_allocator_clear(allocator)` | Clear arena |
|
||||||
| `wapp_mem_arena_allocator_destroy(allocator)` | Destroy arena |
|
| `wapp_mem_arena_allocator_destroy(allocator)` | Destroy arena |
|
||||||
|
|
||||||
> **Note:** The arena allocator only supports `alloc` and `alloc_aligned`. `realloc`, `realloc_aligned`, and `free` are not implemented (arenas do not support individual frees).
|
> **Note:** Only `free` is not implemented — arenas do not support individual deallocation. `alloc`, `alloc_aligned`, `realloc`, and `realloc_aligned` are all supported.
|
||||||
|
|
||||||
```c
|
```c
|
||||||
Allocator allocator = wapp_mem_arena_allocator_init(KiB(16));
|
Allocator allocator = wapp_mem_arena_allocator_init(KiB(16));
|
||||||
|
|||||||
Reference in New Issue
Block a user