wasm-bindgen icon indicating copy to clipboard operation
wasm-bindgen copied to clipboard

How to increase the memory size of the interpreter in wasm-bindgen-wasm-interpreter?

Open TheVeryDarkness opened this issue 2 years ago • 4 comments

Summary

I've run out of the memory (the field mem in Interpreter) when generating interface with wasm-bindgen (called from wasm-pack) for my project. Maybe my project is too big? Will it be okay to simply extend the memory size when storing to a place that is not in the vector?

Additional Details

The program panicked at wasm-bindgen-wasm-interpreter-0.2.87/src/lib.rs:311:32: index out of bounds: the len is 1024 but the index is 375022

Run with wasm-pack build.

TheVeryDarkness avatar Oct 13 '23 05:10 TheVeryDarkness

This seems like a rather big increase to me, more then two orders of magnitude. Do you know what exactly is causing this?

Cc #3162.

daxpedda avatar Oct 13 '23 12:10 daxpedda

Let me have a fork, increase the capacity and test it in my program.

TheVeryDarkness avatar Oct 14 '23 01:10 TheVeryDarkness

I have a similar issue when linking emscripten's libc (compiled to wasm32-unknown-unknown).

Here's a minimal reproduction repo (just run ./build.sh - sorry, only tested on macOS for now. Assumes cargo and wasm-bindgen are in PATH): https://github.com/gustavohenke/wasm-bindgen-libc-bug

(in fact, I hit #3315 unless __environ.c is ignored)

I can go ignoring several files and the issue just moves around; it seems to have to do with files that depend on CURRENT_LOCALE, which is the case of strftime, used in the above example repo. https://github.com/emscripten-core/emscripten/blob/5b24a09de582f3943d75aa6af9be36ba719c08c0/system/lib/libc/musl/src/internal/locale_impl.h#L40

$ cargo --version
cargo 1.70.0 (ec8a8a0ca 2023-04-25)
$ rustc --version
rustc 1.70.0 (90c541806 2023-05-31)
$ clang --version
Homebrew clang version 16.0.6
Target: arm64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /opt/homebrew/opt/llvm/bin
$ wasm-bindgen --version
wasm-bindgen 0.2.87

gustavohenke avatar Oct 16 '23 01:10 gustavohenke

Let me have a fork, increase the capacity and test it in my program.

Actually, simply increase the capacity won't work, as some other errors will show up.

TheVeryDarkness avatar Oct 17 '23 06:10 TheVeryDarkness

Let me have a fork, increase the capacity and test it in my program.

Actually, simply increase the capacity won't work, as some other errors will show up.

In light of this I will close this issue.

daxpedda avatar Mar 12 '24 09:03 daxpedda