Class Memory
Represents the WebAssembly memory. Memory is allocated in pages, which are 64k bytes in size.
Namespace: WasmerSharp
Assembly: WasmerSharp.dll
Syntax
public class Memory : WasmerSharp.WasmerNativeHandle
Constructors
Memory(UInt32, Nullable<UInt32>)
Constructor for memory, throws if there is an error.
Declaration
public Memory (uint minPages, Nullable<uint> maxPages = null);
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | minPages | Minimum number of allowed pages |
System.Nullable<System.UInt32> | maxPages | Optional, Maximum number of allowed pages |
Properties
Data
Returns a pointer to the memory backing this Memory instance.
Declaration
public IntPtr Data { get; }
Property Value
Type | Description |
---|---|
System.IntPtr | To be added. |
DataLength
Returns the current length in bytes of the given memory
Declaration
public uint DataLength { get; }
Property Value
Type | Description |
---|---|
System.UInt32 | To be added. |
PageLength
Returns the current length in pages of the given memory
Declaration
public uint PageLength { get; }
Property Value
Type | Description |
---|---|
System.UInt32 | To be added. |
Methods
Create(UInt32, Nullable<UInt32>)
Creates a memory block with the specified minimum and maxiumum limits
Declaration
public static WasmerSharp.Memory Create (uint minPages, Nullable<uint> maxPages = null);
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | minPages | Minimum number of allowed pages |
System.Nullable<System.UInt32> | maxPages | Optional, Maximum number of allowed pages |
Returns
Type | Description |
---|---|
Memory | The object on success, or null on failure. You can use the LastError error property to get details on the error. |
Grow(UInt32)
Grows the memory by the specified amount of pages.
Declaration
public bool Grow (uint deltaPages);
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | deltaPages | The number of additional pages to grow |
Returns
Type | Description |
---|---|
System.Boolean | true on success, false on error. You can use the LastError property to get more details on the error. |