yaze 0.2.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::core::MemoryTracker Class Reference

#include <memory_tracker.h>

Classes

struct  AllocationInfo
 

Public Member Functions

void TrackAllocation (const void *ptr, size_t size, const char *type)
 
void TrackDeallocation (const void *ptr)
 
size_t GetTotalAllocated () const
 
void DumpAllocations () const
 
bool IsFreed (const void *ptr) const
 

Static Public Member Functions

static MemoryTrackerGetInstance ()
 

Private Member Functions

 MemoryTracker ()=default
 

Private Attributes

std::unordered_map< const void *, AllocationInfoallocations_
 
size_t total_allocated_ = 0
 
std::mutex mutex_
 

Detailed Description

Definition at line 14 of file memory_tracker.h.

Constructor & Destructor Documentation

◆ MemoryTracker()

yaze::core::MemoryTracker::MemoryTracker ( )
privatedefault

Referenced by GetInstance().

Member Function Documentation

◆ GetInstance()

static MemoryTracker & yaze::core::MemoryTracker::GetInstance ( )
inlinestatic

◆ TrackAllocation()

void yaze::core::MemoryTracker::TrackAllocation ( const void * ptr,
size_t size,
const char * type )
inline

Definition at line 21 of file memory_tracker.h.

References allocations_, mutex_, and total_allocated_.

Referenced by yaze::gfx::AllocateSurface(), and yaze::gfx::AllocateTexture().

◆ TrackDeallocation()

void yaze::core::MemoryTracker::TrackDeallocation ( const void * ptr)
inline

◆ GetTotalAllocated()

size_t yaze::core::MemoryTracker::GetTotalAllocated ( ) const
inline

Definition at line 36 of file memory_tracker.h.

References mutex_, and total_allocated_.

◆ DumpAllocations()

void yaze::core::MemoryTracker::DumpAllocations ( ) const
inline

Definition at line 41 of file memory_tracker.h.

References allocations_, mutex_, and total_allocated_.

◆ IsFreed()

bool yaze::core::MemoryTracker::IsFreed ( const void * ptr) const
inline

Definition at line 57 of file memory_tracker.h.

References allocations_, and mutex_.

Member Data Documentation

◆ allocations_

std::unordered_map<const void*, AllocationInfo> yaze::core::MemoryTracker::allocations_
private

Definition at line 70 of file memory_tracker.h.

Referenced by DumpAllocations(), IsFreed(), TrackAllocation(), and TrackDeallocation().

◆ total_allocated_

size_t yaze::core::MemoryTracker::total_allocated_ = 0
private

◆ mutex_

std::mutex yaze::core::MemoryTracker::mutex_
mutableprivate

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