Class DirectMalloc

java.lang.Object
org.teavm.interop.DirectMalloc

public final class DirectMalloc extends Object
Linear memory allocator for creating "direct buffers" in WASM GC

DO NOT USE IN LEGACY WASM BACKEND!!! Make a regular byte array, and use Address.ofData()

Similar to dlmalloc and emmalloc (emscripten's malloc)

bad things will happen if you free an address that was never allocated
  • Method Details

    • malloc

      public static Address malloc(int sizeBytes)
    • calloc

      public static Address calloc(int sizeBytes)
    • free

      public static void free(Address ptr)
    • memcpy

      public static void memcpy(Address dst, Address src, int count)
    • memset

      public static void memset(Address ptr, int val, int count)
    • zmemset

      public static void zmemset(Address ptr, int count)