File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,23 @@ TlsfAllocator<T>::TlsfAllocator(const T size)
75
75
AddNewBlock (paddedSize, TO_HEADER (data));
76
76
}
77
77
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
+
78
95
template <typename T>
79
96
void TlsfAllocator<T>::CreateHeader(uint8_t * ptr, const T size, HeaderFlags flags)
80
97
{
Original file line number Diff line number Diff line change @@ -70,13 +70,19 @@ class TlsfAllocator
70
70
* @brief Empty constructor Initialises the constructor and size to 0 (null)
71
71
*/
72
72
TlsfAllocator ();
73
+
73
74
/* *
74
75
* @brief Size initialiser. Accepts a number representing the number of bytes to allocate to
75
76
* the allocator's memory buffer
76
77
* @param size the number of bytes to allocate, cannot be less than 16
77
78
*/
78
79
TlsfAllocator (const T size);
79
80
81
+ /* *
82
+ * @brief Destructor, deallocates all memory and sets all values to zero
83
+ */
84
+ ~TlsfAllocator ();
85
+
80
86
// Deleted copy and move constructors
81
87
82
88
TlsfAllocator (const TlsfAllocator& other) = delete ;
You can’t perform that action at this time.
0 commit comments