1template <plAllocatorTrackingMode TrackingMode,
bool OverwriteMemoryOnReset>
4 , m_DestructData(pParent)
5 , m_PtrToDestructDataIndexTable(pParent)
9template <plAllocatorTrackingMode TrackingMode,
bool OverwriteMemoryOnReset>
15template <plAllocatorTrackingMode TrackingMode,
bool OverwriteMemoryOnReset>
22 if (destructorFunc !=
nullptr)
24 plUInt32 uiIndex = m_DestructData.GetCount();
25 m_PtrToDestructDataIndexTable.Insert(ptr, uiIndex);
27 auto& data = m_DestructData.ExpandAndGetRef();
28 data.m_Func = destructorFunc;
35template <plAllocatorTrackingMode TrackingMode,
bool OverwriteMemoryOnReset>
41 if (m_PtrToDestructDataIndexTable.Remove(pPtr, &uiIndex))
43 auto& data = m_DestructData[uiIndex];
44 data.m_Func =
nullptr;
51PL_MSVC_ANALYSIS_WARNING_PUSH
55PL_MSVC_ANALYSIS_WARNING_DISABLE(6313)
57template <plAllocatorTrackingMode TrackingMode,
bool OverwriteMemoryOnReset>
62 for (plUInt32 i = m_DestructData.GetCount(); i-- > 0;)
64 auto& data = m_DestructData[i];
65 if (data.m_Func !=
nullptr)
66 data.m_Func(data.m_Ptr);
69 m_DestructData.Clear();
70 m_PtrToDestructDataIndexTable.Clear();
72 this->m_allocator.Reset();
73 if constexpr (TrackingMode >= plAllocatorTrackingMode::AllocationStats)
75 plMemoryTracker::RemoveAllAllocations(this->m_Id);
77 else if constexpr (TrackingMode >= plAllocatorTrackingMode::Basics)
80 this->m_allocator.FillStats(stats);
82 plMemoryTracker::SetAllocatorStats(this->m_Id, stats);
85PL_MSVC_ANALYSIS_WARNING_POP
Base class for all memory allocators.
Definition Allocator.h:23
Policy based allocator implementation of the plAllocator interface.
Definition AllocatorWithPolicy.h:19
Definition LinearAllocator.h:12
virtual void * Allocate(size_t uiSize, size_t uiAlign, plMemoryUtils::DestructorFunction destructorFunc) override
Interface, do not use this directly, always use the new/delete macros below.
Definition LinearAllocator_inl.h:16
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
Definition Allocator.h:26