Skip to content

Commit d4ac494

Browse files
committed
src: use a higher limit in the NearHeapLimitCallback
V8 requires the NearHeapLimitCallback to return a limit that's higher than the initial one or otherwise it will crash.
1 parent d9de812 commit d4ac494

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/env.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1631,7 +1631,10 @@ size_t Environment::NearHeapLimitCallback(void* data,
16311631
env->isolate()->AutomaticallyRestoreInitialHeapLimit(0.95);
16321632

16331633
env->is_processing_heap_limit_callback_ = false;
1634-
return initial_heap_limit;
1634+
1635+
// The new limit must be higher than initial_heap_limit or V8 might
1636+
// crash.
1637+
return initial_heap_limit + 1;
16351638
}
16361639

16371640
inline size_t Environment::SelfSize() const {

0 commit comments

Comments
 (0)