Stream: git-wasmtime

Topic: wasmtime / Issue #2532 Allow capping memory (potentially ...


view this post on Zulip Wasmtime GitHub notifications bot (Dec 24 2020 at 17:07):

SoniEx2 opened Issue #2532:

<!-- Please try to describe precisely what you would like to do in
Cranelift/Wasmtime and/or expect from it. You can answer the questions below if
they're relevant and delete this text before submitting. Thanks for opening an
issue! -->

Feature

<!-- What is the feature or code improvement you would like to do in
Cranelift/Wasmtime? -->

The ability to force-cap (exported) memories.

Benefit

<!-- What is the value of adding this in Cranelift/Wasmtime? -->

You can't cap at runtime the exported memories from emscripten. You can tell emscripten to import memory instead. WASI doesn't work with imported memory. (arguably this is an emscripten problem but WASI states memories are to be exported, not imported. so if the whole idea of importing memories goes against WASI anyway, why do it that way? being able to cap exported memories would be WASI-compliant on the other hand.)

Implementation

<!-- Do you have an implementation plan, and/or ideas for data structures or
algorithms to use? -->

Just let one be able to set the Memory max to a smaller value, as long as it's no smaller than the current Memory size.

Alternatives

<!-- Have you considered alternative implementations? If so, how are they
better or worse than your proposal? -->

Alternatives:

The only general-purpose solution is this proposal. Whether you have memory imports or exports, this proposal is always guaranteed to work, whereas the alternatives require a lot more cooperation from the wasm module (as they'd have to import memory instead of following WASI spec and exporting it).


Last updated: Nov 22 2024 at 17:03 UTC