|
memory_arena
|
Stack-based scoped memory management for arenas. More...
Include dependency graph for arena_stack.c:Go to the source code of this file.
Functions | |
| void | arena_stack_clear (t_arena_stack *stack) |
| Clear all stack frames without modifying arena state. | |
| void | arena_stack_init (t_arena_stack *stack, t_arena *arena) |
| Initialize an arena stack with a given arena. | |
| void | arena_stack_pop (t_arena_stack *stack) |
| Pop and restore the last saved state from the stack. | |
| void | arena_stack_push (t_arena_stack *stack) |
| Push the current arena state onto the stack. | |
Stack-based scoped memory management for arenas.
This module implements a lightweight stack system on top of arena-based memory. It allows users to push and pop memory states using marker frames allocated within the arena itself. This pattern enables efficient and structured management of temporary memory regions.
Core functionality includes:
arena_mark() saved as stack frames.arena_pop().All stack frames are stored inside the arena, meaning no additional heap allocations or deallocations are required.
Typical use cases:
push, pop, clear) are local to the arena and safe to use as long as the arena is not destroyed or reset externally. Definition in file arena_stack.c.