Stream: git-wasmtime

Topic: wasmtime / PR #13166 Fix DRC leak when passing same objec...


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

fitzgen opened PR #13166 from fitzgen:issue-13037 to bytecodealliance:main:

The expose_gc_ref_to_wasm function takes ownership of a GC reference in the process of exposing it to raw Wasm code. For the DRC collector, this inserts the GC ref into the over-approximated-stack-roots list, as the Wasm stack logically holds a reference to the object. That reference is cleaned up when we scan the stack during GC and consolidate between what is actually still in use on the Wasm stack vs what is only in the OASR list.

However, the OASR list cannot contain duplicates (it is an intrusive linked list in the DRC object header) so if the object was already in the list, then we would not insert it into the list again. But this then causes leaks because expose_gc_ref_to_wasm took ownership of the GC reference because the OASR list clean up during GC only decrefs a single time.

The solution is to decref in expose_gc_ref_to_wasm when the object is already in the OASR list.

Fixes #13037

<!--
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 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 (Apr 21 2026 at 18:52):

fitzgen requested alexcrichton for a review on PR #13166.

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

fitzgen requested wasmtime-core-reviewers for a review on PR #13166.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 21 2026 at 18:58):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 21 2026 at 18:58):

alexcrichton has enabled auto merge for PR #13166.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 21 2026 at 19:05):

alexcrichton added PR #13166 Fix DRC leak when passing same object to Wasm multiple times to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 21 2026 at 19:29):

github-merge-queue[bot] removed PR #13166 Fix DRC leak when passing same object to Wasm multiple times from the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 21 2026 at 21:57):

github-actions[bot] added the label wasmtime:ref-types on PR #13166.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 21 2026 at 21:57):

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

view this post on Zulip Wasmtime GitHub notifications bot (Apr 21 2026 at 21:58):

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

Subscribe to Label Action

cc @fitzgen

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

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 (Apr 22 2026 at 13:17):

fitzgen updated PR #13166.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 22 2026 at 13:17):

fitzgen has enabled auto merge for PR #13166.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 22 2026 at 13:32):

fitzgen added PR #13166 Fix DRC leak when passing same object to Wasm multiple times to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 22 2026 at 13:56):

fitzgen merged PR #13166.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 22 2026 at 13:56):

fitzgen removed PR #13166 Fix DRC leak when passing same object to Wasm multiple times from the merge queue.


Last updated: May 03 2026 at 22:13 UTC