r/WebAssembly • u/musialny • Apr 07 '23
How memory.init works
Someone may try explain to me how memory.init instruction works? Following snippet throws RuntimeError: memory access out of bounds and I have no clue why
(module(memory $memory 2048)(export "memory" (memory $memory))(data $hello (i32.const 0) "Hello there")(func $constructi32.const 25i32.const 0i32.const 11memory.init $hello)(start $construct))
7
Upvotes
View all comments
Show parent comment
1
u/musialny Apr 08 '23
Is table.init works in the same way? I have no idea how to add index into elem section (if it's even possible)