memory_arena
Loading...
Searching...
No Matches
arena_stack.h
Go to the documentation of this file.
1
32#ifndef ARENA_STACK_H
33#define ARENA_STACK_H
34
35#include "arena.h"
36#include <stdbool.h>
37#include <stddef.h>
38
39#ifdef __cplusplus
40extern "C"
41{
42#endif
43
59
75
91 void arena_stack_init(t_arena_stack* stack, t_arena* arena);
92
113 void arena_stack_push(t_arena_stack* stack);
114
132 void arena_stack_pop(t_arena_stack* stack);
133
145 void arena_stack_clear(t_arena_stack* stack);
146
147#ifdef __cplusplus
148}
149#endif
150
151#endif // ARENA_STACK_H
Core public API for the Arena memory allocator.
size_t marker
Marker to rewind arena to this point.
Definition arena_stack.h:56
t_arena_stack_frame * top
Top of the stack (most recent frame)
Definition arena_stack.h:73
t_arena * arena
Arena associated with this stack.
Definition arena_stack.h:72
struct s_arena_stack_frame * prev
Previous frame in the stack.
Definition arena_stack.h:57
void arena_stack_push(t_arena_stack *stack)
Push the current arena state onto the stack.
void arena_stack_pop(t_arena_stack *stack)
Pop and restore the last saved state from the stack.
struct s_arena_stack_frame t_arena_stack_frame
Internal frame representing a single state snapshot in the stack.
struct s_arena_stack t_arena_stack
Stack structure for scoped arena memory control.
void arena_stack_init(t_arena_stack *stack, t_arena *arena)
Initialize an arena stack with a given arena.
void arena_stack_clear(t_arena_stack *stack)
Clear all stack frames without modifying arena state.
Stack structure for scoped arena memory control.
Definition arena_stack.h:71
Internal frame representing a single state snapshot in the stack.
Definition arena_stack.h:55
The main memory arena structure used for fast allocation.