|
memory_arena
|
Internal helpers and utilities for scratch arena pool management. More...
Collaboration diagram for Scratch Arena Internals:Data Structures | |
| struct | s_scratch_slot |
| Represents a single slot in the scratch arena pool. More... | |
Typedefs | |
| typedef struct s_scratch_slot | t_scratch_slot |
| Represents a single slot in the scratch arena pool. | |
Functions | |
| static bool | scratch_slot_init (t_scratch_slot *slot, size_t slot_size, int index) |
| Initialize a single scratch slot with its own arena. | |
Internal helpers and utilities for scratch arena pool management.
| struct s_scratch_slot |
Represents a single slot in the scratch arena pool.
Each slot holds a memory arena (t_arena) and an atomic flag indicating whether the slot is currently in use.
Definition at line 73 of file arena_scratch.h.
Collaboration diagram for s_scratch_slot:| Data Fields | ||
|---|---|---|
| t_arena | arena | Memory arena associated with this slot. |
| atomic_bool | in_use | Atomic flag for acquisition tracking. |
| typedef struct s_scratch_slot t_scratch_slot |
#include <arena_scratch.h>
Represents a single slot in the scratch arena pool.
Each slot holds a memory arena (t_arena) and an atomic flag indicating whether the slot is currently in use.
|
static |
#include <arena_scratch.c>
Initialize a single scratch slot with its own arena.
This internal helper sets up a t_scratch_slot by initializing the internal arena with the given slot_size. The arena is marked as growable, and the slot is initially marked as not in use.
On failure, an error is reported using arena_report_error(), indicating the index of the slot that failed to initialize.
| slot | Pointer to the scratch slot to initialize. |
| slot_size | Size of the arena to allocate for the slot. |
| index | Index of the slot (used for debugging/logging). |
true if the slot was successfully initialized, false otherwise.scratch_pool_init() to initialize each slot in the scratch pool.Definition at line 449 of file arena_scratch.c.
References s_scratch_slot::arena, arena_init(), arena_report_error(), and s_scratch_slot::in_use.