2019-03-27 17:41:06 +01:00
..
2019-03-27 17:21:52 +01:00
2019-03-27 17:21:52 +01:00
2019-03-27 17:21:52 +01:00
2019-03-27 17:41:06 +01:00
2019-03-27 17:21:52 +01:00
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
    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
    Frees a dynamically allocated chunk of memory by its address.

Optional

  • __mem_reset(ref: usize, parentRef: usize): void
    Resets dynamic memory to its initial state. Used by the arena allocator.