Skip to content

Commit f6f744a

Browse files
committed
Fix gc_hints not being send
1 parent cddc556 commit f6f744a

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

src/runtime/js.zig

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -301,22 +301,21 @@ pub fn Env(comptime S: type, comptime types: anytype) type {
301301
// no init, must be initialized via env.newExecutor()
302302

303303
pub fn deinit(self: *Executor) void {
304-
if (self.scope) |scope| {
305-
const isolate = scope.isolate;
304+
if (self.scope != null) {
306305
self.endScope();
306+
}
307307

308-
// V8 doesn't immediately free memory associated with
309-
// a Context, it's managed by the garbage collector. So, when the
310-
// `gc_hints` option is enabled, we'll use the `lowMemoryNotification`
311-
// call on the isolate to encourage v8 to free any contexts which
312-
// have been freed.
313-
if (self.env.gc_hints) {
314-
var handle_scope: v8.HandleScope = undefined;
315-
v8.HandleScope.init(&handle_scope, isolate);
316-
defer handle_scope.deinit();
317-
318-
self.env.isolate.lowMemoryNotification();
319-
}
308+
// V8 doesn't immediately free memory associated with
309+
// a Context, it's managed by the garbage collector. So, when the
310+
// `gc_hints` option is enabled, we'll use the `lowMemoryNotification`
311+
// call on the isolate to encourage v8 to free any contexts which
312+
// have been freed.
313+
if (self.env.gc_hints) {
314+
var handle_scope: v8.HandleScope = undefined;
315+
v8.HandleScope.init(&handle_scope, self.env.isolate);
316+
defer handle_scope.deinit();
317+
318+
self.env.isolate.lowMemoryNotification(); // TODO we only need to call this for the main World Executor
320319
}
321320
self.call_arena.deinit();
322321
self.scope_arena.deinit();

0 commit comments

Comments
 (0)