memory.size
Gets the size of the memory in pages. Memory is made up of pages. Each page is 64Kb (64 * 1024 bytes).

Syntax

memory.size

Stack In

NONE

Stack Out

i32 The size of memory in pages.

Example

;; Create memory 1 page in size and can grow to 20 pages
(memory 1 20)
  
;; Create function
(func $getMemorySize (result i32)
  ;; Get the number of pages in memory
  memory.size

  ;; The stack contains an i32 value of 1 page
)