22 lines
757 B
Markdown
Raw Normal View History

2019-03-27 17:21:52 +01:00
Memory manager interface
========================
A memory manager for AssemblyScript must implement the following common and may implement any number of optional interfaces:
Common
------
* **__mem_allocate**(size: `usize`): `usize`<br />
Dynamically allocates a chunk of memory of at least the specified size and returns its address.
Alignment must be guaranteed to be at least 8 bytes, but there are considerations to increase
alignment to 16 bytes to fit SIMD v128 values.
* **__mem_free**(ref: `usize`): `void`<br />
Frees a dynamically allocated chunk of memory by its address.
Optional
--------
2019-03-27 17:41:06 +01:00
* **__mem_reset**(ref: `usize`, parentRef: `usize`): `void`<br />
2019-03-27 17:21:52 +01:00
Resets dynamic memory to its initial state. Used by the arena allocator.