|
memory_arena
|
Debugging utilities and hooks for the arena memory allocator. More...
#include "arena_config.h"#include <stdarg.h>#include <stdatomic.h>#include <stddef.h>#include <stdint.h>#include <stdio.h>
Include dependency graph for arena_debug.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Data Structures | |
| struct | s_arena_debug |
| Debug metadata associated with an arena. More... | |
Macros | |
| #define | ALOG(...) ((void) 0) |
Debug logging macro (enabled only if ARENA_DEBUG_LOG is set). | |
| #define | ARENA_ASSERT(cond) ((void) 0) |
| #define | ARENA_ASSERT_VALID(arena) ((void) 0) |
| #define | ARENA_CHECK(arena) ((void) 0) |
| #define | arena_poison_memory(ptr, size) ((void) (ptr), (void) (size)) |
| No-op poison macro when poisoning is disabled. | |
| #define | ARENA_POISON_PATTERN 0xDEADBEEF |
| Poison value used when overwriting memory in debug mode. | |
Typedefs | |
| typedef void(* | arena_error_callback) (const char *message, void *context) |
| Type for error callback functions. | |
| typedef struct s_arena | t_arena |
| Arena structure forward declaration. | |
| typedef struct s_arena_debug | t_arena_debug |
| Debug metadata associated with an arena. | |
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. | |
Debugging utilities and hooks for the arena memory allocator.
This header defines debug-related features for arena memory systems, including:
These features are controlled via compile-time flags in arena_config.h:
ARENA_DEBUG_LOGARENA_POISON_MEMORYARENA_DEBUG_CHECKSThis module is optional and designed to aid development, debugging, diagnostics, and testing of arena-based systems.
Definition in file arena_debug.h.
| struct s_arena_debug |
Debug metadata associated with an arena.
Definition at line 64 of file arena_debug.h.
| Data Fields | ||
|---|---|---|
| arena_error_callback | error_cb | Callback function for reporting errors. |
| void * | error_context | Optional context passed to the error callback. |
| char | id[ARENA_ID_LEN] | Unique identifier string (e.g., "A#0001"). |
| const char * | label | Optional user-provided label for logging/debug. |
| atomic_int | subarena_counter | Internal counter for sub-arenas. |
| #define ALOG | ( | ... | ) | ((void) 0) |
Debug logging macro (enabled only if ARENA_DEBUG_LOG is set).
Definition at line 173 of file arena_debug.h.
| #define ARENA_ASSERT | ( | cond | ) | ((void) 0) |
Definition at line 157 of file arena_debug.h.
| #define ARENA_ASSERT_VALID | ( | arena | ) | ((void) 0) |
Definition at line 159 of file arena_debug.h.
| #define ARENA_CHECK | ( | arena | ) | ((void) 0) |
Definition at line 158 of file arena_debug.h.
| #define arena_poison_memory | ( | ptr, | |
| size | |||
| ) | ((void) (ptr), (void) (size)) |
No-op poison macro when poisoning is disabled.
Definition at line 123 of file arena_debug.h.
| #define ARENA_POISON_PATTERN 0xDEADBEEF |
Poison value used when overwriting memory in debug mode.
Definition at line 111 of file arena_debug.h.
| typedef void(* arena_error_callback) (const char *message, void *context) |
Type for error callback functions.
| message | The error message string. |
| context | Optional user-defined context pointer. |
Definition at line 58 of file arena_debug.h.
Arena structure forward declaration.
Definition at line 50 of file arena_debug.h.
| typedef struct s_arena_debug t_arena_debug |
Debug metadata associated with an arena.