Free more memory in destructOnExit and add assertion

This commit is contained in:
Jarred Sumner
2025-09-19 03:52:59 -07:00
parent 5102538fc3
commit 9cf86eed08

View File

@@ -210,6 +210,8 @@
#include <unistd.h>
#endif
#include "mimalloc.h"
using namespace Bun;
BUN_DECLARE_HOST_FUNCTION(Bun__NodeUtil__jsParseArgs);
@@ -4665,7 +4667,10 @@ extern "C" void Zig__GlobalObject__destructOnExit(Zig::GlobalObject* globalObjec
globalObject = nullptr;
vm.heap.collectNow(JSC::Sync, JSC::CollectionScope::Full);
vm.derefSuppressingSaferCPPChecking();
ASSERT_WITH_MESSAGE(vm.hasOneRef(), "JSC::VM has more than one ref. destructOnExit will not work.");
vm.derefSuppressingSaferCPPChecking();
WTF::releaseFastMallocFreeMemory();
mi_collect(false);
}
#include "ZigGeneratedClasses+lazyStructureImpl.h"