Closed jordy25519 closed 5 years ago
That's 1 MiB of stack + data sections
What is the max memory size? I'm confused why there even is a max being set.
That's 1 MiB of stack + data sections
So is it correct to say that 16 pages is the default initial allocation for stack and data in this case? If so, how can I achieve the above vector assignment using the stack only (i.e. without increasing the initial allocation above 16)?
What is the max memory size? I'm confused why there even is a max being set.
Turns out a post processing tool was improperly handling the memory section, I've opened a separate issue there to track it: https://github.com/paritytech/wasm-utils/issues/105
Actually, it seems the root issue was a regression upstream in rustc(?)
Bad Environment
❯ rustc -V
rustc 1.33.0-nightly (68fe5182c 2019-01-05)
❯ cargo -V
cargo 1.33.0-nightly (34320d212 2019-01-03)
Initializes 17 memory pages (1 we actually requested + 16 from somewhere else...)
> wasm-objdump -x -j memory /path/to/example.wasm
Memory[1]:
- memory[0] pages: initial=17
Fixed in this Environment (latest nightly at time of writing)
❯ rustc -V
rustc 1.33.0-nightly (ceb251214 2019-01-16)
❯ cargo -V
cargo 1.33.0-nightly (2b4a5f1f0 2019-01-12)
Only allocates 1 page
> wasm-objdump -x -j memory /path/to/example.wasm
Memory[1]:
- memory[0] pages: initial=1
I'm compiling some minimal rust code to wasm and am getting some errors regarding initial vs. maximum memory allocation when running
wasm-validate
e.g.0000041: error: memory initial size must be <= max size
. I don't understand how I can increase maximum memory pages or why/where/how the initial request for 16 is made.Not sure if this is the right place for this but any help would be much appreciated.
The minimal code
Running
wasm-objdump -x </path/to/.wasm>
produces: A memory section like thisCan someone explain why 17 (pages) are allocated in this case? I don't understand how this works.
Environment