|
memory_arena
|
Lightweight, thread-local memory arenas for fast temporary allocations. More...
Files | |
| file | arena_tlscratch.h |
| Thread-local scratch arena interface for fast temporary allocations. | |
Functions | |
| void | destroy_thread_scratch_arena (void) |
| Destroy the thread-local scratch arena for the calling thread. | |
| t_arena * | get_thread_scratch_arena (void) |
| Get the thread-local scratch arena, resetting it before use. | |
| t_arena * | get_thread_scratch_arena_ref (void) |
| Access the raw thread-local arena pointer without initialization. | |
| void | set_thread_scratch_arena_size (size_t size) |
| Configure the initial size for the thread-local scratch arena. | |
Lightweight, thread-local memory arenas for fast temporary allocations.
This group provides functions for accessing a private scratch arena that is unique per thread. These arenas are lazily initialized and automatically reset on each access to ensure clean, reusable memory without synchronization.
Use cases include:
alloca() or short-lived heap allocationsThe thread-local scratch arena system is enabled via the ARENA_ENABLE_THREAD_LOCAL_SCRATCH macro.
scratch_arena_pool. It is not safe to share the returned arena between threads. | void destroy_thread_scratch_arena | ( | void | ) |
#include <arena_tlscratch.h>
Destroy the thread-local scratch arena for the calling thread.
Definition at line 295 of file arena_tlscratch.c.
References arena_report_error().
| t_arena * get_thread_scratch_arena | ( | void | ) |
#include <arena_tlscratch.h>
Get the thread-local scratch arena, resetting it before use.
t_arena, or NULL if disabled or failed.Definition at line 289 of file arena_tlscratch.c.
References arena_report_error().
| t_arena * get_thread_scratch_arena_ref | ( | void | ) |
#include <arena_tlscratch.h>
Access the raw thread-local arena pointer without initialization.
t_arena.get_thread_scratch_arena(). Definition at line 307 of file arena_tlscratch.c.
References arena_report_error().
| void set_thread_scratch_arena_size | ( | size_t | size | ) |
#include <arena_tlscratch.h>
Configure the initial size for the thread-local scratch arena.
| size | Desired size in bytes. |
get_thread_scratch_arena() is used in the same thread. Definition at line 300 of file arena_tlscratch.c.
References arena_report_error().