Plasma Engine  2.0
Loading...
Searching...
No Matches
plMemoryTracker Class Reference

Memory tracker which keeps track of all allocations and constructions. More...

#include <MemoryTracker.h>

Classes

struct  AllocationInfo
 
class  Iterator
 

Public Types

using PrintFunc = void (*)(const char* szLine)
 Callback for printing strings.
 

Static Public Member Functions

static plAllocatorId RegisterAllocator (plStringView sName, plAllocatorTrackingMode mode, plAllocatorId parentId)
 
static void DeregisterAllocator (plAllocatorId allocatorId)
 
static void AddAllocation (plAllocatorId allocatorId, plAllocatorTrackingMode mode, const void *pPtr, size_t uiSize, size_t uiAlign, plTime allocationTime)
 
static void RemoveAllocation (plAllocatorId allocatorId, const void *pPtr)
 
static void RemoveAllAllocations (plAllocatorId allocatorId)
 
static void SetAllocatorStats (plAllocatorId allocatorId, const plAllocator::Stats &stats)
 
static void ResetPerFrameAllocatorStats ()
 
static plStringView GetAllocatorName (plAllocatorId allocatorId)
 
static const plAllocator::StatsGetAllocatorStats (plAllocatorId allocatorId)
 
static plAllocatorId GetAllocatorParentId (plAllocatorId allocatorId)
 
static const AllocationInfoGetAllocationInfo (plAllocatorId allocatorId, const void *pPtr)
 
static Iterator GetIterator ()
 
static plUInt32 PrintMemoryLeaks (PrintFunc printfunc)
 Reports back information about all currently known root memory leaks.
 
static void DumpMemoryLeaks ()
 Prints the known memory leaks to plLog and triggers an assert if there are any.
 

Detailed Description

Memory tracker which keeps track of all allocations and constructions.

Member Function Documentation

◆ DumpMemoryLeaks()

void plMemoryTracker::DumpMemoryLeaks ( )
static

Prints the known memory leaks to plLog and triggers an assert if there are any.

This is useful to call at the end of an application, to get a debug breakpoint in case of memory leaks.

◆ PrintMemoryLeaks()

plUInt32 plMemoryTracker::PrintMemoryLeaks ( PrintFunc printfunc)
static

Reports back information about all currently known root memory leaks.

Returns the number of found memory leaks.


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