cataggar opened issue #10363:
I'm attempting to use the TypeScript compiler from a component. When I call
createProgram
TypeScript reads in a bunch of files. The problems is it is running out of memory. I found this out by addingWASMTIME_LOG=trace
, which shows:2025-03-10T11:30:10.964128Z TRACE wit-bindgen export{module="wasi:cli/run@0.2.3" function="run"}: wasmtime::runtime::vm::component::libcalls: utf8-to-utf8 1306131 2025-03-10T11:30:24.235781Z TRACE wit-bindgen export{module="wasi:cli/run@0.2.3" function="run"}: wasmtime::runtime::vm::component::libcalls: utf8-to-utf8 35 Error: "createProgram failed: out of memory"
This happens directly haver it tries to read in a faily large
lib.dom.d.ts
file.
read_file "node_modules/typescript/lib/lib.dom.d.ts" length 1306131Copilot helped me find the docs on linear memory and claimed that adding
--static-memory-maximum-size=0
would work by not limiting the memory, but the option does not exist. Is there a way to unrestrict the memory limit and increase it?This happens directly
wasmtime --static-memory-maximum-size=0 run --dir .::/ test-rs/target/test2.wasm a b c
wasmtime run --dir .::/ test-rs/target/test2.wasm a b c
Feature
Ability to set
static_memory_maximum_size
from the command line.Benefit
Being able to control the memory options from the CLI.
Implementation
Alternatives
cataggar edited issue #10363:
I'm attempting to use the TypeScript compiler from a component. When I call
createProgram
TypeScript reads in a bunch of files. The problems is it is running out of memory. I found this out by addingWASMTIME_LOG=trace
, which shows:2025-03-10T11:30:10.964128Z TRACE wit-bindgen export{module="wasi:cli/run@0.2.3" function="run"}: wasmtime::runtime::vm::component::libcalls: utf8-to-utf8 1306131 2025-03-10T11:30:24.235781Z TRACE wit-bindgen export{module="wasi:cli/run@0.2.3" function="run"}: wasmtime::runtime::vm::component::libcalls: utf8-to-utf8 35 Error: "createProgram failed: out of memory"
This happens directly haver it tries to read in a faily large
lib.dom.d.ts
file.read_file "node_modules/typescript/lib/lib.dom.d.ts" length 1306131
Copilot helped me find the docs on linear memory and claimed that adding
--static-memory-maximum-size=0
would work by not limiting the memory, but the option does not exist. Is there a way to unrestrict the memory limit and increase it?This happens directly
wasmtime --static-memory-maximum-size=0 run --dir .::/ test-rs/target/test2.wasm a b c
wasmtime run --dir .::/ test-rs/target/test2.wasm a b c
Feature
Ability to set
static_memory_maximum_size
from the command line.Benefit
Being able to control the memory options from the CLI.
Implementation
Alternatives
cataggar edited issue #10363:
I'm attempting to use the TypeScript compiler from a component. When I call
createProgram
TypeScript reads in a bunch of files. The problems is it is running out of memory. I found this out by addingWASMTIME_LOG=trace
, which shows:2025-03-10T11:30:10.964128Z TRACE wit-bindgen export{module="wasi:cli/run@0.2.3" function="run"}: wasmtime::runtime::vm::component::libcalls: utf8-to-utf8 1306131 2025-03-10T11:30:24.235781Z TRACE wit-bindgen export{module="wasi:cli/run@0.2.3" function="run"}: wasmtime::runtime::vm::component::libcalls: utf8-to-utf8 35 Error: "createProgram failed: out of memory"
This happens directly haver it tries to read in a faily large
lib.dom.d.ts
file.read_file "node_modules/typescript/lib/lib.dom.d.ts" length 1306131
Copilot helped me find the docs on linear memory and claimed that adding
--static-memory-maximum-size=0
would work by not limiting the memory, but the option does not exist. Is there a way to unrestrict the memory limit and increase it?This is the current command line:
wasmtime run --dir .::/ test-rs/target/test2.wasm a b c
I was hoping this would work:
wasmtime --static-memory-maximum-size=0 run --dir .::/ test-rs/target/test2.wasm a b c
Feature
Ability to set
static_memory_maximum_size
from the command line.Benefit
Being able to control the memory options from the CLI.
Implementation
Alternatives
cataggar edited issue #10363:
I'm attempting to use the TypeScript compiler from a component. When I call
createProgram
TypeScript reads in a bunch of files. The problems is it is running out of memory. I found this out by addingWASMTIME_LOG=trace
, which shows:2025-03-10T11:30:10.964128Z TRACE wit-bindgen export{module="wasi:cli/run@0.2.3" function="run"}: wasmtime::runtime::vm::component::libcalls: utf8-to-utf8 1306131 2025-03-10T11:30:24.235781Z TRACE wit-bindgen export{module="wasi:cli/run@0.2.3" function="run"}: wasmtime::runtime::vm::component::libcalls: utf8-to-utf8 35 Error: "createProgram failed: out of memory"
This happens directly haver it tries to read in a faily large
lib.dom.d.ts
file.read_file "node_modules/typescript/lib/lib.dom.d.ts" length 1306131
Copilot helped me find the docs on linear memory and claimed that adding
--static-memory-maximum-size=0
would work by not limiting the memory, but the option does not exist. Is there a way to unrestrict the memory limit and increase it?This is the current command line:
wasmtime run --dir .::/ test-rs/target/test2.wasm a b c
I was hoping this would work:
wasmtime --static-memory-maximum-size=0 run --dir .::/ test-rs/target/test2.wasm a b c
My environment:
~/ms/StarlingMonkey15> wasmtime --version wasmtime 30.0.2 (398694a59 2025-02-25) ~/ms/StarlingMonkey15> sw_vers ProductName: macOS ProductVersion: 15.3.1 BuildVersion: 24D70
Feature
Ability to set
static_memory_maximum_size
from the command line.Benefit
Being able to control the memory options from the CLI.
Implementation
Alternatives
cataggar edited issue #10363:
I'm attempting to use the TypeScript compiler from a component. When I call
createProgram
TypeScript reads in a bunch of files. The problems is it is running out of memory. I found this out by addingWASMTIME_LOG=trace
, which shows:2025-03-10T11:30:10.964128Z TRACE wit-bindgen export{module="wasi:cli/run@0.2.3" function="run"}: wasmtime::runtime::vm::component::libcalls: utf8-to-utf8 1306131 2025-03-10T11:30:24.235781Z TRACE wit-bindgen export{module="wasi:cli/run@0.2.3" function="run"}: wasmtime::runtime::vm::component::libcalls: utf8-to-utf8 35 Error: "createProgram failed: out of memory"
This happens directly haver it tries to read in a faily large
lib.dom.d.ts
file.read_file "node_modules/typescript/lib/lib.dom.d.ts" length 1306131
Copilot helped me find the docs on linear memory and claimed that adding
--static-memory-maximum-size=0
would work by not limiting the memory, but the option does not exist. Is there a way to unrestrict the memory limit and increase it?This is the current command line:
wasmtime run --dir .::/ test-rs/target/test2.wasm a b c
I was hoping this would work:
wasmtime --static-memory-maximum-size=0 run --dir .::/ test-rs/target/test2.wasm a b c
My environment:
~/ms/StarlingMonkey15> wasmtime --version wasmtime 30.0.2 (398694a59 2025-02-25) ~/ms/StarlingMonkey15> sw_vers ProductName: macOS ProductVersion: 15.3.1 BuildVersion: 24D70 ~/ms/StarlingMonkey15> ^uname -m arm64
Feature
Ability to set
static_memory_maximum_size
from the command line.Benefit
Being able to control the memory options from the CLI.
Implementation
Alternatives
bjorn3 commented on issue #10363:
static_memory_maximum_size
(now calledmemory_reservation
) defaults to 4GB on 64bit platforms (which is also the maximum a wasm module can address when not using memory64/wasm64). It could be that your wasm module itself has placed a limit on the memory size. There is no way to override such a limit other than recompiling the wasm module with a bigger limit. It could also be that tsc genuinely needs more than 4GB on your code, in which case you need to compile for wasm64.
cataggar commented on issue #10363:
Thanks @bjorn3. Good chance it genuinely needs more than 4GB. I'll look into wasm64.
cataggar edited issue #10363:
I'm attempting to use the TypeScript compiler from a component. When I call
createProgram
TypeScript reads in a bunch of files. The problems is it is running out of memory. I found this out by addingWASMTIME_LOG=trace
, which shows:2025-03-10T11:30:10.964128Z TRACE wit-bindgen export{module="wasi:cli/run@0.2.3" function="run"}: wasmtime::runtime::vm::component::libcalls: utf8-to-utf8 1306131 2025-03-10T11:30:24.235781Z TRACE wit-bindgen export{module="wasi:cli/run@0.2.3" function="run"}: wasmtime::runtime::vm::component::libcalls: utf8-to-utf8 35 Error: "createProgram failed: out of memory"
This happens directly after it tries to read in a faily large
lib.dom.d.ts
file.read_file "node_modules/typescript/lib/lib.dom.d.ts" length 1306131
Copilot helped me find the docs on linear memory and claimed that adding
--static-memory-maximum-size=0
would work by not limiting the memory, but the option does not exist. Is there a way to unrestrict the memory limit and increase it?This is the current command line:
wasmtime run --dir .::/ test-rs/target/test2.wasm a b c
I was hoping this would work:
wasmtime --static-memory-maximum-size=0 run --dir .::/ test-rs/target/test2.wasm a b c
My environment:
~/ms/StarlingMonkey15> wasmtime --version wasmtime 30.0.2 (398694a59 2025-02-25) ~/ms/StarlingMonkey15> sw_vers ProductName: macOS ProductVersion: 15.3.1 BuildVersion: 24D70 ~/ms/StarlingMonkey15> ^uname -m arm64
Feature
Ability to set
static_memory_maximum_size
from the command line.Benefit
Being able to control the memory options from the CLI.
Implementation
Alternatives
alexcrichton closed issue #10363:
I'm attempting to use the TypeScript compiler from a component. When I call
createProgram
TypeScript reads in a bunch of files. The problems is it is running out of memory. I found this out by addingWASMTIME_LOG=trace
, which shows:2025-03-10T11:30:10.964128Z TRACE wit-bindgen export{module="wasi:cli/run@0.2.3" function="run"}: wasmtime::runtime::vm::component::libcalls: utf8-to-utf8 1306131 2025-03-10T11:30:24.235781Z TRACE wit-bindgen export{module="wasi:cli/run@0.2.3" function="run"}: wasmtime::runtime::vm::component::libcalls: utf8-to-utf8 35 Error: "createProgram failed: out of memory"
This happens directly after it tries to read in a faily large
lib.dom.d.ts
file.read_file "node_modules/typescript/lib/lib.dom.d.ts" length 1306131
Copilot helped me find the docs on linear memory and claimed that adding
--static-memory-maximum-size=0
would work by not limiting the memory, but the option does not exist. Is there a way to unrestrict the memory limit and increase it?This is the current command line:
wasmtime run --dir .::/ test-rs/target/test2.wasm a b c
I was hoping this would work:
wasmtime --static-memory-maximum-size=0 run --dir .::/ test-rs/target/test2.wasm a b c
My environment:
~/ms/StarlingMonkey15> wasmtime --version wasmtime 30.0.2 (398694a59 2025-02-25) ~/ms/StarlingMonkey15> sw_vers ProductName: macOS ProductVersion: 15.3.1 BuildVersion: 24D70 ~/ms/StarlingMonkey15> ^uname -m arm64
Feature
Ability to set
static_memory_maximum_size
from the command line.Benefit
Being able to control the memory options from the CLI.
Implementation
Alternatives
alexcrichton commented on issue #10363:
For future reference you can find up-to-date API documentation at https://docs.rs/wasmtime/latest/wasmtime/, I'll update the link you found though to match that. Otherwise though looks like this is solved so I'm going to close.
Copilot ... claimed ...
I'd perhaps drop a reminder here that AI things are helpful but need to be checked. They're not infallible and in this situation it gave you flat-out-wrong information. The
--static-memory-maximum-size=0
flag never un-set a limit of memory, it was completely different.
cataggar commented on issue #10363:
Thanks @alexcrichton! I'm aware of the AI pitfals. That you for your work also on the wasm64-unknown-unknown target.. Any plans for a 64-bit wasi target after that such as
wasm64-wasip2
?
cataggar edited a comment on issue #10363:
Thanks @alexcrichton! I'm aware of the AI pitfals. Thank you for your work also on the wasm64-unknown-unknown target.. Any plans for a 64-bit wasi target after that such as
wasm64-wasip2
?
alexcrichton commented on issue #10363:
For more information on that see https://github.com/bytecodealliance/wasmtime/issues/4311
cataggar edited a comment on issue #10363:
Thanks @alexcrichton! I'm aware of the AI pitfals. Thank you for your work also on the wasm64-unknown-unknown target. Any plans for a 64-bit wasi target after that such as
wasm64-wasip2
?
Last updated: Apr 18 2025 at 12:05 UTC