我有一个 rust 项目,我正在根据http://asquera.de/blog/2017-04-10/the-path-to-rust-on-the-web/编译到 webasm
项目编译。当我在 Chrome Canary 中运行它时,它会耗尽内存并给我一个非常有用的错误消息:
abort("Cannot enlarge memory arrays. Either (1) compile with -s
TOTAL_MEMORY=X with X higher than the current value 16777216, (2) compile
with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime,
...
问题是,不清楚如何将这些标志传递给 rustc / 构建工具链。
既不设置 EMMAKEN_CFLAGS 也不进行以下工作:
cargo rustc -v --target=wasm32-unknown-emscripten --release -- -Clink-args="-s TOTAL_MEMORY=33554432"