Fix gc_hints not being send

This commit is contained in:
sjorsdonkers
2025-05-02 15:06:21 +02:00
parent cddc55694a
commit f6f744aea1

View File

@@ -301,9 +301,9 @@ pub fn Env(comptime S: type, comptime types: anytype) type {
// no init, must be initialized via env.newExecutor() // no init, must be initialized via env.newExecutor()
pub fn deinit(self: *Executor) void { pub fn deinit(self: *Executor) void {
if (self.scope) |scope| { if (self.scope != null) {
const isolate = scope.isolate;
self.endScope(); self.endScope();
}
// V8 doesn't immediately free memory associated with // V8 doesn't immediately free memory associated with
// a Context, it's managed by the garbage collector. So, when the // a Context, it's managed by the garbage collector. So, when the
@@ -312,11 +312,10 @@ pub fn Env(comptime S: type, comptime types: anytype) type {
// have been freed. // have been freed.
if (self.env.gc_hints) { if (self.env.gc_hints) {
var handle_scope: v8.HandleScope = undefined; var handle_scope: v8.HandleScope = undefined;
v8.HandleScope.init(&handle_scope, isolate); v8.HandleScope.init(&handle_scope, self.env.isolate);
defer handle_scope.deinit(); defer handle_scope.deinit();
self.env.isolate.lowMemoryNotification(); self.env.isolate.lowMemoryNotification(); // TODO we only need to call this for the main World Executor
}
} }
self.call_arena.deinit(); self.call_arena.deinit();
self.scope_arena.deinit(); self.scope_arena.deinit();