Skip to main content

cove_free

Function cove_free 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn cove_free(ptr: *mut u8, len: usize)
Expand description

Releases a block cove_alloc answered, or an answer block one of the entry points answered.

For an answer block, len is the four-byte prefix plus the length it holds — the JavaScript side has both numbers by the time it decodes the payload, so asking it for the total is cheaper than storing the total here.

§Safety

ptr must have come from cove_alloc or from an entry point of this module, len must be the size that block was created with, and the block must not be freed twice.