fix: reclaim isolate host RSS on oneshot user-worker retirement - #722
Open
samvallad33 wants to merge 1 commit into
Open
fix: reclaim isolate host RSS on oneshot user-worker retirement#722samvallad33 wants to merge 1 commit into
samvallad33 wants to merge 1 commit into
Conversation
Retired workers already leave the pool (activeUserWorkersCount hits 0) while V8/host pages stay resident on the worker thread. Decommit the isolate and purge that thread's allocator after JsRuntime drop.
kallebysantos
self-requested a review
August 29, 2026 02:22
samvallad33
marked this pull request as ready for review
August 30, 2026 03:03
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.
Oneshot retirement already drives
activeUserWorkersCountto 0. Host RSS still grows ~2.5 MiB per isolate.The worker is gone from the pool; the isolate's host pages are not. V8 leaves committed heap on the pinned worker thread, and that thread's allocator never returns those pages (
mi_collect/malloc_trim/malloc_zone_pressure_relief).EdgeRuntime.miCollect()only purges the main worker.This decommits the isolate on termination and drops host allocator pages in
DenoRuntime::dropafterJsRuntimedispose, on the same thread that owned the isolate.test_oneshot_retirement_drops_user_workerchecks the pool count hits 0 after oneshot shutdown. It does not measure RSS.Fixes #719