Skip to content

Commit f112f5e

Browse files
committed
Added destructor to TlsfAllocator
1 parent 288a097 commit f112f5e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

engine/utils/allocators/Tlsf.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,23 @@ TlsfAllocator<T>::TlsfAllocator(const T size)
7575
AddNewBlock(paddedSize, TO_HEADER(data));
7676
}
7777

78+
template<typename T>
79+
TlsfAllocator<T>::~TlsfAllocator()
80+
{
81+
if (data) free(data);
82+
83+
totalBytesRemaining = 0;
84+
capacity = 0;
85+
bytesRemaining = 0;
86+
totalSize = 0;
87+
88+
flBitmask = 0;
89+
90+
data = nullptr;
91+
freeList = nullptr;
92+
slBitmasks = nullptr;
93+
}
94+
7895
template<typename T>
7996
void TlsfAllocator<T>::CreateHeader(uint8_t* ptr, const T size, HeaderFlags flags)
8097
{

0 commit comments

Comments
 (0)