Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
TheVeryDarkness opened this issue Oct 13, 2023 · 5 comments
Labels

Comments

@TheVeryDarkness
Copy link

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.

@daxpedda
Copy link
Collaborator

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.

@TheVeryDarkness
Copy link
Author

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

@gustavohenke
Copy link

gustavohenke commented Oct 16, 2023

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

@TheVeryDarkness
Copy link
Author

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.

@daxpedda
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants