ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
Loading...
Searching...
No Matches
Debug

Files

file  memory.h
 🔍 Memory debugging helpers for tracking allocations in debug builds
 

Detailed Description

This module provides memory allocation wrappers that track all heap allocations for debugging and leak detection. When DEBUG_MEMORY is defined and NDEBUG is not set, all allocations are recorded in a linked list with source location metadata.

Features

Usage

Typically used via macros that inject __FILE__ and __LINE__:

#define TRACKED_MALLOC(size) debug_malloc(size, __FILE__, __LINE__)
#define TRACKED_FREE(ptr) debug_free(ptr, __FILE__, __LINE__)

At program exit, call debug_memory_report() to print memory statistics and any outstanding (leaked) allocations.

Build Modes

See also
debug_memory_report() for generating leak reports