JsonArray::remove() and JsonObject::remove() now release the memory of strings

This commit is contained in:
Benoit Blanchon
2018-11-09 17:27:32 +01:00
parent e842838a23
commit f375459d53
68 changed files with 1504 additions and 740 deletions

View File

@@ -23,12 +23,11 @@ class FixedSizeRamString {
}
template <typename TMemoryPool>
const char* save(TMemoryPool* memoryPool) const {
StringSlot* save(TMemoryPool* memoryPool) const {
if (!_str) return NULL;
void* dup = memoryPool->alloc(_size);
if (!dup) return NULL;
memcpy(dup, _str, _size);
return static_cast<const char*>(dup);
StringSlot* slot = memoryPool->allocFrozenString(_size);
if (slot) memcpy(slot->value, _str, _size);
return slot;
}
size_t size() const {