chore: increase wasi memory limits (#2035)

This commit is contained in:
LongYinan 2024-04-13 18:35:08 +08:00 committed by GitHub
parent f1b8ab5e64
commit 16f0d49284
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 11 deletions

View file

@ -24,8 +24,10 @@ const __wasi = new __WASI({
const __emnapiContext = __emnapiGetDefaultContext()
const __sharedMemory = new WebAssembly.Memory({
initial: 1024,
maximum: 10240,
// 1Gb
initial: 16384,
// 4Gb
maximum: 65536,
shared: true,
})
@ -95,8 +97,10 @@ const __wasi = new __nodeWASI({
const __emnapiContext = __emnapiGetDefaultContext()
const __sharedMemory = new WebAssembly.Memory({
initial: 1024,
maximum: 10240,
// 1Gb
initial: 16384,
// 4Gb
maximum: 65536,
shared: true,
})

View file

@ -16,11 +16,10 @@ pub fn setup() {
println!("cargo:rustc-link-arg=--export=emnapi_async_worker_init");
println!("cargo:rustc-link-arg=--import-memory");
println!("cargo:rustc-link-arg=--import-undefined");
println!("cargo:rustc-link-arg=--shared-memory");
println!("cargo:rustc-link-arg=--max-memory=2147483648");
// lld only allocates 1MiB for the WebAssembly stack, and the array that you're allocating on the stack is exactly 1MiB.
// 0x800000 bytes = 8MiB
println!("cargo:rustc-link-arg=-zstack-size=0x800000");
println!("cargo:rustc-link-arg=--max-memory=4294967296");
// lld only allocates 1MiB for the WebAssembly stack.
// 6400000 bytes = 64MiB
println!("cargo:rustc-link-arg=-zstack-size=6400000");
println!("cargo:rustc-link-arg=--no-check-features");
if let Ok(setjmp_link_dir) = env::var("SETJMP_LINK_DIR") {
println!("cargo:rustc-link-search={setjmp_link_dir}");

View file

@ -24,8 +24,9 @@ const __wasi = new __nodeWASI({
const __emnapiContext = __emnapiGetDefaultContext()
const __sharedMemory = new WebAssembly.Memory({
initial: 1024,
maximum: 10240,
initial: 16384,
// 4Gb
maximum: 65536,
shared: true,
})