forked from bblanchon/ArduinoJson
Add MemoryPool::deallocPool()
This commit is contained in:
@ -46,16 +46,14 @@ class MemoryPool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
~MemoryPool() {
|
~MemoryPool() {
|
||||||
if (_begin)
|
deallocPool();
|
||||||
_allocator->deallocate(_begin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MemoryPool(const MemoryPool&) = delete;
|
MemoryPool(const MemoryPool&) = delete;
|
||||||
MemoryPool& operator=(const MemoryPool& src) = delete;
|
MemoryPool& operator=(const MemoryPool& src) = delete;
|
||||||
|
|
||||||
MemoryPool& operator=(MemoryPool&& src) {
|
MemoryPool& operator=(MemoryPool&& src) {
|
||||||
if (_begin)
|
deallocPool();
|
||||||
_allocator->deallocate(_begin);
|
|
||||||
_allocator = src._allocator;
|
_allocator = src._allocator;
|
||||||
_begin = src._begin;
|
_begin = src._begin;
|
||||||
_end = src._end;
|
_end = src._end;
|
||||||
@ -265,6 +263,11 @@ class MemoryPool {
|
|||||||
ARDUINOJSON_ASSERT(isAligned(_end));
|
ARDUINOJSON_ASSERT(isAligned(_end));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void deallocPool() {
|
||||||
|
if (_begin)
|
||||||
|
_allocator->deallocate(_begin);
|
||||||
|
}
|
||||||
|
|
||||||
Allocator* _allocator;
|
Allocator* _allocator;
|
||||||
char *_begin, *_left, *_right, *_end;
|
char *_begin, *_left, *_right, *_end;
|
||||||
bool _overflowed;
|
bool _overflowed;
|
||||||
|
Reference in New Issue
Block a user