Grow

The grow instruction, increases the size of the memory instance by a specified number of pages, each page is sized 64KiB.

The grow instruction returns previous size of memory, in pages, if the operation was successful, and returns -1 if the operation failed.

Try it

Syntax

wasm

;; load the number of memory pages to grow the memory by
i32.const 3

;; grow the memory by 3 pages
memory.grow

;; the top item on the stack will now either be the previous number of pages (success) or `-1` (failure)
Instruction Binary opcode
memory.grow 0x40