alexcrichton opened PR #14507 from alexcrichton:refactor-release-memory to bytecodealliance:main:
This commit first refactors the logic added in #14419 to avoid open-coding the index allocator internals in more than one location. A new
AllocModeis used to encapsulate "only warm" and then the internal implementation of "take all warm slots" is a simpler loop than before.This then additionally fixes a bug in the implementation where the
decommit_pagescall was done only for the firstbytes_residentpages, but with features likePAGEMAP_SCANenabled these bytes could be sparsely contained within the slot, so now the madvise happens for the entire slot rather than just the number of resident bytes.Finally, this documents a consequence of the current implementation which is that concurrent instantiations may fail while the method is running. The fix doesn't seem worth it at this time so I figured it was at least good to document.
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease review the Bytecode Alliance's AI tool usage policy at
https://github.com/bytecodealliance/governance/blob/main/AI_TOOL_POLICY.mdPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
alexcrichton requested cfallin for a review on PR #14507.
alexcrichton requested wasmtime-core-reviewers for a review on PR #14507.
github-actions[bot] added the label wasmtime:api on PR #14507.
:thumbs_up: cfallin submitted PR review:
This is much cleaner -- thanks!
cfallin added PR #14507 Refactor and document release_resident_unused_memory a bit to the merge queue.
:check: cfallin merged PR #14507.
cfallin removed PR #14507 Refactor and document release_resident_unused_memory a bit from the merge queue.
Last updated: Oct 11 2026 at 04:10 UTC