Raven Engine v0.1
Loading...
Searching...
No Matches
Raven::MemoryManager Class Reference

Central singleton for managing engine memory allocators. More...

#include <MemoryManager.h>

Public Member Functions

MalevolentAllocatorGetMalevolentAllocator (usize chunkSize, usize chunkCount)
 Retrieves or creates a pool allocator for fixed-size chunks.
template<typename T>
StackAllocator< T > & GetStackAllocator (usize elementCount)
 Retrieves or creates a stack allocator for type T.

Static Public Member Functions

static MemoryManagerGet ()
 Gets the global MemoryManager instance.

Detailed Description

Central singleton for managing engine memory allocators.

Provides access to pool and stack allocators. Ensures allocators are reused and tracked. Integrates with MemoryTracker for leak detection and profiling.

The MemoryManager provides centralized access to different allocation strategies in the engine, including pool-based (MalevolentAllocator) and stack-based (StackAllocator) allocators. Allocators are created on demand and cached for reuse. This manager also integrates with the memory tracking system for debugging and profiling.

Member Function Documentation

◆ Get()

MemoryManager & Raven::MemoryManager::Get ( )
inlinestatic

Gets the global MemoryManager instance.

Returns
Reference to the singleton MemoryManager.

◆ GetMalevolentAllocator()

MalevolentAllocator & Raven::MemoryManager::GetMalevolentAllocator ( usize chunkSize,
usize chunkCount )

Retrieves or creates a pool allocator for fixed-size chunks.

Parameters
chunkSizeSize of each chunk in bytes.
chunkCountNumber of chunks to allocate.
Returns
Reference to a MalevolentAllocator instance.

◆ GetStackAllocator()

template<typename T>
StackAllocator< T > & Raven::MemoryManager::GetStackAllocator ( usize elementCount)
inline

Retrieves or creates a stack allocator for type T.

Template Parameters
TThe element type for the stack allocator.
Parameters
elementCountNumber of elements the allocator can hold.
Returns
Reference to a StackAllocator for type T.

The documentation for this class was generated from the following files: