free

public func free(consuming RawPointer)

Wraps free(3) — releases memory previously returned by malloc / realloc.

Calling free on a null pointer is defined as a no-op. Calling it on any other pointer that was not produced by these allocators (or has already been freed) is undefined behaviour.

Safety

ptr must be either null or the original pointer returned by a previous malloc / realloc. After free, the pointer is dangling — do not read, write, or free it again.

Defined in lang/std/ffi/libc.ks