Module hdk::prelude::allocation

source ·

Functions§

  • Allocate bytes that won’t be dropped by the allocator. Return the pointer to the leaked allocation so the host can write to it.
  • Free an allocation. Needed because we leak memory every time we call __hc__allocate_1 and write_bytes.
  • Attempt to consume bytes from a known guest_ptr and len.
  • Given an owned vector of bytes, leaks it and returns a pointer the host can use to read the bytes. This does NOT handle the length of the bytes, so the guest will need to track the length separately from leaking the vector.