memory_arena
Loading...
Searching...
No Matches
Functions
arena_stats.c File Reference

Arena statistics and diagnostics module. More...

#include "arena.h"
#include <stdlib.h>
#include <string.h>
+ Include dependency graph for arena_stats.c:

Go to the source code of this file.

Functions

t_arena_stats arena_get_stats (const t_arena *arena)
 Return a snapshot of the arena's internal statistics.
 
void arena_print_stats (t_arena *arena, FILE *stream)
 Print formatted diagnostics about the arena to a stream.
 
void arena_stats_record_growth (t_arena_stats *stats, size_t size)
 Append a new growth event to the growth_history array.
 

Detailed Description

Arena statistics and diagnostics module.

Author
Toonsa
Date
2025

This module provides tools for inspecting, printing, recording, and retrieving memory usage statistics from a memory arena (t_arena). These features are useful for profiling, debugging, and tracking memory behavior in applications that use arenas for allocation.

The statistics include:

Core functions:

All functions are safe to use in multi-threaded environments when thread safety is enabled in the arena.

Note
Statistics are updated internally by the arena system. Most users will only need to use the print or get functions for diagnostics.

Definition in file arena_stats.c.