Skip to content

Lightpanda: the headless browser designed for AI and automation

enable automatic restoration of initial heap limit

Halil Durak7211cfa6db80
diff --git a/src/browser/js/Env.zig b/src/browser/js/Env.zig
index fae6096f2..8b3dcc3bc 100644
--- a/src/browser/js/Env.zig
+++ b/src/browser/js/Env.zig
@@ -583,15 +583,11 @@ pub fn terminate(self: *Env) void {
v8.v8__Isolate__TerminateExecution(self.isolate.handle);
}
-// We need a stable pointer for *Env, so can't be setup in init.
+/// We need a stable pointer for `*Env`, so can't be setup in `init`.
pub fn protectHeapLimit(self: *Env) void {
self.heap_limit_protected = true;
v8.v8__Isolate__AddNearHeapLimitCallback(self.isolate.handle, nearHeapLimit, self);
- // TODO: uncomment this when https://github.com/lightpanda-io/zig-v8-fork/pull/187 lands
- // if our nearHeapLimit extends the memory, we want to restore the original
- // value, since the isolate can be long lived (relative to the page/script
- // that caused the memory spike).
- // v8.v8__Isolate__AutomaticallyRestoreInitialHeapLimit(self.isolate.handle, 0.5);
+ v8.v8__Isolate__AutomaticallyRestoreInitialHeapLimit(self.isolate.handle, 0.5);
}
// v8 is telling us it's about to run out of memory for this isolate. We'll