(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
(memory 1 2)
(memory (data "Hello World"))
(memory (import "importing" "memory"))
(memory (export "memory") 1 5)