Interface MemoryAllocator
- All Known Implementing Classes:
BumpAllocator
public interface MemoryAllocator
Allocates and frees memory within WebAssembly linear memory.
-
Method Summary
-
Method Details
-
allocate
int allocate(int size, int alignment) Allocates a block of memory with the given size and alignment.- Parameters:
size- the number of bytes to allocatealignment- the required alignment in bytes (must be a power of 2)- Returns:
- the offset in linear memory where the block was allocated
-
free
void free(int pointer, int size, int alignment) Frees a previously allocated block of memory.- Parameters:
pointer- the offset of the block to freesize- the size of the block in bytesalignment- the alignment of the block
-