memory_arena
Loading...
Searching...
No Matches
Functions
arena_tlscratch.h File Reference

Thread-local scratch arena interface for fast temporary allocations. More...

#include "arena.h"
#include "arena_tlscratch.h"
+ Include dependency graph for arena_tlscratch.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

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.
 

Detailed Description

Thread-local scratch arena interface for fast temporary allocations.

Author
Toonsa
Date
2025

This header declares the API for managing thread-local memory arenas (t_arena) that are allocated and used independently by each thread. These arenas are:

This system enables low-overhead temporary memory allocations in concurrent environments without requiring explicit synchronization.

Features:

Note
The thread-local scratch system is enabled by the ARENA_ENABLE_THREAD_LOCAL_SCRATCH macro. It is not intended for use across threads and is separate from the general-purpose scratch pool.

Definition in file arena_tlscratch.h.