|
memory_arena
|
Functions and tools for tracking, labeling, poisoning, and validating arenas. More...
Files | |
| file | arena_debug.c |
| Debugging, error reporting, memory poisoning, and integrity checking utilities for the Arena memory allocation system. | |
| file | arena_debug.h |
| Debugging utilities and hooks for the arena memory allocator. | |
Functions | |
| void | arena_default_error_callback (const char *msg, void *ctx) |
| Default fallback error callback (prints to stderr). | |
| void | arena_generate_id (t_arena *arena) |
| Generate a unique debug ID for an arena. | |
| void | arena_report_error (t_arena *arena, const char *fmt,...) |
| Report an error from an arena using its configured error callback. | |
| void | arena_set_debug_label (t_arena *arena, const char *label) |
| Assign a debug label to an arena. | |
| void | arena_set_error_callback (t_arena *arena, arena_error_callback cb, void *context) |
| Set a custom error callback function for reporting arena errors. | |
Variables | |
| static atomic_int | g_arena_id_counter = 0 |
| Global atomic counter for generating unique arena IDs. | |
Functions and tools for tracking, labeling, poisoning, and validating arenas.
This group includes optional tools to enhance runtime diagnostics:
0xDEADBEEF)These are primarily intended for debug builds and are configurable via macros like ARENA_DEBUG_CHECKS.
| void arena_default_error_callback | ( | const char * | msg, |
| void * | ctx | ||
| ) |
#include <arena_debug.h>
Default fallback error callback (prints to stderr).
Definition at line 310 of file arena_debug.c.
| void arena_generate_id | ( | t_arena * | arena | ) |
#include <arena_debug.h>
Generate a unique debug ID for an arena.
Definition at line 102 of file arena_debug.c.
References ARENA_ID_LEN, and g_arena_id_counter.
| void arena_report_error | ( | t_arena * | arena, |
| const char * | fmt, | ||
| ... | |||
| ) |
#include <arena_debug.h>
Report an error from an arena using its configured error callback.
Definition at line 253 of file arena_debug.c.
| void arena_set_debug_label | ( | t_arena * | arena, |
| const char * | label | ||
| ) |
#include <arena_debug.h>
Assign a debug label to an arena.
Definition at line 147 of file arena_debug.c.
| void arena_set_error_callback | ( | t_arena * | arena, |
| arena_error_callback | cb, | ||
| void * | context | ||
| ) |
#include <arena_debug.h>
Set a custom error callback function for reporting arena errors.
Definition at line 201 of file arena_debug.c.
References arena_default_error_callback().
|
static |
#include <arena_debug.c>
Global atomic counter for generating unique arena IDs.
This counter is used to assign a unique identifier string to each arena when arena_generate_id() is called. It ensures that each arena gets a distinct label (e.g., "A#0001", "A#0002", etc.), which can help in debugging, profiling, and tracking arena lifetimes.
The counter is atomic to ensure thread-safe incrementation in concurrent environments.
arena_generate_id() to retrieve or assign an arena ID. Definition at line 66 of file arena_debug.c.