# Juliet\include\Core\Memory\MemoryArenaDebug

## Source Files
- Header: `Juliet\include\Core\Memory\MemoryArenaDebug.h`
- Source: `Juliet\src\Core\Memory\MemoryArenaDebug.cpp`

## AI Description
The `MemoryArenaDebug.h` header file provides a debug mechanism for managing memory allocations within an arena, allowing developers to track and manage the allocation history of memory blocks. The `MemoryArenaDebug.cpp` source file implements these functionalities, including registering and unregistering arenas, setting debug names, freeing debug information from blocks, removing allocations, popping allocations to a new position, and adding debug information for each allocation.

The `ArenaDebugInfo` struct is used to store detailed information about each memory block, such as the tag associated with it, its size, offset within the arena, and pointers to the next debug information entry. The `ArenaAllocation` struct represents individual allocations within an arena, including their size, offset, and a reference to the tag.

The `DebugRegisterArena`, `DebugUnregisterArena`, `DebugArenaSetDebugName`, `IsDebugInfoArena`, `DebugArenaFreeBlock`, `DebugArenaRemoveAllocation`, `DebugArenaPopTo`, and `DebugArenaAddDebugInfo` functions handle various aspects of arena management, ensuring that debug information is correctly tracked and managed throughout the application.

## Symbols

### Namespace `Juliet`

#### Classes, Structs & Unions
- `struct ArenaDebugInfo`
- `struct ArenaAllocation`

#### Functions & Methods
- `// Arena (Struct)
    void DebugRegisterArena(NonNullPtr<Arena> arena)`
- `void DebugUnregisterArena(NonNullPtr<Arena> arena)`
- `void DebugArenaSetDebugName(NonNullPtr<Arena> arena, const char* name)`
- `bool IsDebugInfoArena(const Arena* arena)`
- `// To prevent recursion
    void DebugArenaFreeBlock(Arena* block)`
- `// To clear all debug infos in a block
    void DebugArenaRemoveAllocation(Arena* block, size_t oldOffset)`
- `void DebugArenaPopTo(Arena* block, size_t newPosition)`
- `void DebugArenaAddDebugInfo(Arena* block, size_t size, size_t offset, const char* tag)`
- `// MemoryArena (Pool-based)
    void DebugFreeArenaAllocations(MemoryBlock* blk)`
- `void DebugArenaAddAllocation(MemoryBlock* blk, size_t size, size_t offset, String tag)`
- `void DebugArenaRemoveLastAllocation(MemoryBlock* blk)`

