Found and fixed a memory leak in the rope strings

Also fixed a bit manipulation error in the GC.
This commit is contained in:
2026-05-10 15:39:04 +10:00
parent 3b813da1cf
commit 83fb5222a2
9 changed files with 124 additions and 6 deletions
+8
View File
@@ -20,10 +20,18 @@ static void incrementRefCount(Toy_String* str) {
static void decrementRefCount(Toy_String* str) {
str->info.refCount--;
if (str->info.type == TOY_STRING_NODE) {
//the parent of this node triggered a decrement across the whole tree
decrementRefCount(str->node.left);
decrementRefCount(str->node.right);
}
if (str->info.refCount == 0) {
if (str->info.type == TOY_STRING_NODE) {
//THIS node has triggered the decrement, so run this again
decrementRefCount(str->node.left);
decrementRefCount(str->node.right);
}
//mark this memory as unused
Toy_releaseBucketPartition((void*)str);
}
}