← All built-ins / free()

free()

unsafe
free(...$args): void

Parameters

NameTypeDescription
$ptrpointerraw pointer from FFI

Return value

Frees the memory. Double-free = corruption; that is why this needs unsafe.

Example

echo "// unsafe { free($p); }";
// unsafe { free($p); }

This call needs a real environment (window, server, database or stdin) — the snippet above shows the typical usage shape.

See also

ffi_load()memcpy()