bytecodealliance / bytecodealliance/wasmtime

Command modules are easy to leak memory with

Open
#1,913 1 comment 0 reactions 0 assignees View on GitHub
wasmtime:api
Dominant language
Rust
Stars
18.6k
Forks
1.8k
Avg merge
1d 16h
Merged PRs (30d)
135

Description

The implementation of "command" modules in `Linker` will create a new `Instance` each time an export is invoked. This works well implementation-wise but it's also easy to leak memory and resources unintentionally. No `Instance` is actually deallocated until the `Store` is dropped, which means that commands are a vector for repeatedly creating instances by accident without ever actually deleting them.

I'm not really sure what the best way to handle this would be, but we should probably either document this or look into a fix!

cc @sunfishcode

Contributor guide

Open the contributing guide

Research direction

Start by reading the Linker command-module implementation and the Instance and Store lifecycle described in the issue. Determine whether the appropriate outcome is documentation or a fix; done means either clearly documenting the retention behavior or preventing unintended accumulation of instances and resources.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
devtools
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.