Stream: git-wasmtime

Topic: wasmtime / PR #14314 Drop cached compiler contexts betwee...


view this post on Zulip Wasmtime GitHub notifications bot (Sep 10 2026 at 20:29):

alexcrichton opened PR #14314 from alexcrichton:drop-some-caches to bytecodealliance:main:

This commit is intended to address the issue described in bytecodealliance/wasmtime-go#295 where an embedder upgraded from 47.0.x to 48.0.x and the sustained RSS of the application jumped by a significant margin (~20G). With a reproduction bisection shows that the cause of this jump is #13912.

Poking around a bit #13912 feel pretty surprising to be the cause here, but it ends up being the case that the regalloc2::Context structures that are preserved are apparently quite large, especially for compiled Go functions. These contexts are preserved permanently in an Engine for the entire lifetime of an application. This particular embedding had sort of pathological behavior here where an engine was created per-module, causing the per-engine caches to blow up in size significantly.

This commit adds a hook to module/component compilation to clear out the list of internal caches once a module or component finishes to compile. The rough theory is that these caches help when compiling within a single module but don't have too too much overhead to recreate across modules. The end result though is that these aren't permanently preserved in an Engine and instead there's at least some vector by which large caches are dropped.

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please review the Bytecode Alliance's AI tool usage policy at
https://github.com/bytecodealliance/governance/blob/main/AI_TOOL_POLICY.md

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Sep 10 2026 at 20:29):

alexcrichton requested cfallin for a review on PR #14314.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 10 2026 at 20:29):

alexcrichton requested wasmtime-compiler-reviewers for a review on PR #14314.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 10 2026 at 20:29):

alexcrichton requested wasmtime-core-reviewers for a review on PR #14314.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 10 2026 at 21:44):

github-actions[bot] added the label wasmtime:api on PR #14314.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 10 2026 at 21:44):

github-actions[bot] added the label winch on PR #14314.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 10 2026 at 21:45):

github-actions[bot] commented on PR #14314:

Subscribe to Label Action

cc @saulecabrera

<details>
This issue or pull request has been labeled: "wasmtime:api", "winch"

Thus the following users have been cc'd because of the following labels:

To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.

Learn more.
</details>

view this post on Zulip Wasmtime GitHub notifications bot (Sep 11 2026 at 18:51):

:thumbs_up: cfallin submitted PR review:

Thanks! I'm surprised that we had been holding this memory across all time; it's normal and natural that compilation of big modules will result in spiky memory usage and I would expect we'd release it back to the allocator/OS when done, so I'm glad we do so now!

view this post on Zulip Wasmtime GitHub notifications bot (Sep 11 2026 at 18:52):

cfallin added PR #14314 Drop cached compiler contexts between modules/components to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 11 2026 at 19:17):

:check: cfallin merged PR #14314.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 11 2026 at 19:17):

cfallin removed PR #14314 Drop cached compiler contexts between modules/components from the merge queue.


Last updated: Sep 20 2026 at 18:08 UTC