(memory...)
Create a section of memory. There is only one section of memory per module (this will change in the future). The size of memory is given in pages. Each page is 64Kbs (64 x 1024 bytes).

Syntax

(memory $label (import...) (export...) startingSize maximumSize)
(memory $label (import...) (export...) (data...))

Parameters

$label Optional
There is one default memory per module that has no label. You do not need to give the memory block a label. In the future when you can have more than one memory module this will be used.
startingSize Optional
The number of pages the memory contains.
maximumSize Optional
The maximum number of pages the memory can grow to.
(import...) Optional
Import a link to a WebAssembly.Memory object in JavaScript.
(export...) Optional
Export a link to a WebAssembly.Memory object in JavaScript.
(data...) Optional
Create the memory with some starting data.

Examples

;; Create memory 1 page in size and can grow to 2 pages
(memory 1 2)
;; Create memory with starting data
(memory (data "Hello World"))
;; Create memory imported from JavaScript
(memory (import "importing" "memory"))
;; Create memory and export it to JavaScript. Allow to grow to 5 pages
(memory (export "memory") 1 5)