Skip to content

Commit

Permalink
src: use a higher limit in the NearHeapLimitCallback
Browse files Browse the repository at this point in the history
V8 requires the NearHeapLimitCallback to return a limit that's higher
than the initial one or otherwise it will crash.
  • Loading branch information
joyeecheung committed Nov 30, 2021
1 parent d9de812 commit d4ac494
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/env.cc
Expand Up @@ -1631,7 +1631,10 @@ size_t Environment::NearHeapLimitCallback(void* data,
env->isolate()->AutomaticallyRestoreInitialHeapLimit(0.95);

env->is_processing_heap_limit_callback_ = false;
return initial_heap_limit;

// The new limit must be higher than initial_heap_limit or V8 might
// crash.
return initial_heap_limit + 1;
}

inline size_t Environment::SelfSize() const {
Expand Down

0 comments on commit d4ac494

Please sign in to comment.