Reference-count shared strings

This commit is contained in:
Benoit Blanchon
2023-04-17 09:46:41 +02:00
parent b7c8e0d25c
commit 003087406c
9 changed files with 135 additions and 28 deletions

View File

@ -32,7 +32,6 @@ TEST_CASE("JsonDocument::garbageCollect()") {
AllocatorLog() << AllocatorLog::Allocate(4096)
<< AllocatorLog::Allocate(sizeofString(7))
<< AllocatorLog::Deallocate(sizeofString(7))
<< AllocatorLog::Deallocate(sizeofString(7))
<< AllocatorLog::Deallocate(4096));
}
@ -46,7 +45,7 @@ TEST_CASE("JsonDocument::garbageCollect()") {
bool result = doc.garbageCollect();
REQUIRE(result == false);
REQUIRE(doc.memoryUsage() == sizeofObject(2) + 2 * sizeofString(7));
REQUIRE(doc.memoryUsage() == sizeofObject(2) + sizeofString(7));
REQUIRE(doc.as<std::string>() == "{\"dancing\":2}");
REQUIRE(spyingAllocator.log() == AllocatorLog()