Module hdk::prelude::allocation[][src]

Functions

__allocate

Allocate a length plus a length prefix in bytes that won’t be dropped by the allocator. Return the pointer to it so a length prefix + bytes can be written to the allocation.

__deallocate

Free a length-prefixed allocation. Needed because we leak memory every time we call __allocate and write_bytes.

consume_bytes

Attempt to consume bytes out of a length-prefixed allocation at the given pointer position.

length_prefix_at_guest_ptr

Attempt to extract the length at the given guest_ptr.

write_bytes

Attempt to write a slice of bytes into a length prefixed allocation.