Fix gc memory leak

This commit is contained in:
2024-05-16 22:31:05 -07:00
parent ba9db0ddae
commit d3dc7406cf

View File

@@ -5,6 +5,7 @@
#include <assert.h>
#include <atomic>
#include <cstdint>
#include <inttypes.h>
#include <optional>
#include <stdio.h>
@@ -338,6 +339,20 @@ struct MemManager {
}
next = max + 1;
for (int i = next; i < firstUnaddressable; ++i) {
if (base[i].entry != nullptr) {
#if DEBUG_VERBOSE
if (debugVerboseEnabled) {
printf(
"Collecting %u while collecting right page-unaligned surplus\n",
i);
}
#endif
base[i].entry->delref();
base[i].entry = nullptr;
}
}
// Rebuild free list and delref entries
freeList = 0;
reachable.iterateAbsentApproxBackwards(