2 ms·
This behaviour is platform specific unfortunately. For instance I'm pretty sure that Emscripten-compiled WASM running in browsers will fail if the array doesn't
by flohofwoe 2y ago
This behaviour is platform specific unfortunately. For instance I'm pretty sure that Emscripten-compiled WASM running in browsers will fail if the array doesn't fit into the pre-allocated INITIAL_MEMORY size (even when ALLOW_MEMORY_GROWTH is enabled) - not sure about other WASM runtime environments though. Similar problems probably on embedded platforms without MMU.
- deleted 2y ago[deleted]
- runlaszlorun 2y agoI’ve dinkered around Wasm some but am certainly no expert. Were you referring to the initial memory that is allocated from the Wasm code and/or js, etc? Or is this something set by the Wasm runtime? I haven’t run it myself but I’ve heard others mention that you can prob get several hundred MB to a GB or so but shouldn’t count in getting near the 4GB limit. Nonetheless, that’s plenty for my use case and random hacking.
- flohofwoe 2y agoI'm not sure if it's a WASM requirement or specific to some WASM runtimes or compilers. At least in Emscripten you have an INITIAL_MEMORY linker option which describes the initial size of the WASM heap. The program, its static data and the stack need to fit into this initial size. From that point on, any dynamically allocated data is fine because that will grow the WASM heap as needed (up to 4 GB for wasm32).