Skip to main content

Advanced Wasm Memory Customization

Different Wasm workloads will be using the memory in very different ways.

Make sure you don't do changes without proper benchmarking and analysis.

It's possible to provide a custom implementation of the entire Memory used by the Wasm module:

var instance = Instance.builder(module).withMemoryFactory(limits -> {
return new ByteArrayMemory(limits);
}).build();
note

Endive provides two built-in Memory implementations:

  • ByteArrayMemory: An optimized memory implementation, recommended for recent OpenJDK systems
  • ByteBufferMemory: Recommended for different Java runtimes (in particular, on Android VMs)