Skip to content

How to set maximum memory > default 1GB for WASM? #1971

Answered by kjzl
kjzl asked this question in Q&A
Discussion options

You must be logged in to vote

Actually it seems I just fucked up by not exporting the env variables RUSTFLAGS and RUSTUP_TOOLCHAIN you define at https://github.com/fzyzcjy/flutter_rust_bridge/blob/193f5d0be3b4f16cab454d3e4e83c2bde9ed94ac/frb_dart/lib/src/cli/build_web/executor.dart#L162C6-L162C9

But in realizing you explicitly set the environment for wasm-pack I tested exporting RUSTFLAGS with the -C link-arg=--max-memory=4294967296 and then running wasm-pack, and yes, indeed this solved the problem.

export RUSTUP_TOOLCHAIN="nightly"
export RUSTFLAGS="-C target-feature=+atomics,+bulk-memory,+mutable-globals -C link-arg=--max-memory=4294967296"
wasm-pack build -t no-modules -d /home/kjzl/Desktop/dev-projects/frb_test/w…

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@fzyzcjy
Comment options

@kjzl
Comment options

@fzyzcjy
Comment options

@kjzl
Comment options

Answer selected by kjzl
@kjzl
Comment options

@fzyzcjy
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants