feat: expose individual ResourceConstraints setters and getters#1918
Merged
bartlomieju merged 7 commits intomainfrom Mar 4, 2026
Merged
feat: expose individual ResourceConstraints setters and getters#1918bartlomieju merged 7 commits intomainfrom
bartlomieju merged 7 commits intomainfrom
Conversation
Add bindings for the V8 ResourceConstraints API so that embedders can set individual heap generation limits instead of only using the high-level ConfigureDefaultsFromHeapSize helper. New APIs on CreateParams: - set_max_old_generation_size_in_bytes / max_old_generation_size_in_bytes - set_max_young_generation_size_in_bytes / max_young_generation_size_in_bytes - set_code_range_size_in_bytes / code_range_size_in_bytes - set_stack_limit / stack_limit - set_initial_old_generation_size_in_bytes / initial_old_generation_size_in_bytes - set_initial_young_generation_size_in_bytes / initial_young_generation_size_in_bytes This is needed by Deno to properly implement Node.js-compatible worker thread resource limits (maxOldGenerationSizeMb, maxYoungGenerationSizeMb, codeRangeSizeMb, stackSizeMb). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
devsnek
approved these changes
Mar 3, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
v8::ResourceConstraintssetter/getter methodsCreateParams(e.g.,set_max_old_generation_size_in_bytes)ConfigureDefaultsFromHeapSizeandConfigureDefaultswere exposed, which don't allow setting individual generation limitsMotivation
Deno needs these to properly implement Node.js-compatible
worker_threadsresource limits (maxOldGenerationSizeMb,maxYoungGenerationSizeMb,codeRangeSizeMb,stackSizeMb). Node.js uses these individual setters innode_worker.ccviaWorker::UpdateResourceConstraints.