Function polkavm_derive::sbrk

source ·
pub fn sbrk(size: usize) -> *mut u8
Expand description

Increases the size of the program’s heap by a given number of bytes, allocating memory if necessary. If successful returns a pointer to the end of the heap. If unsuccessful returns a null pointer.

When called with a size of 0 this can be used to find the current end of the heap. This will always succeed.

Memory allocated through this function can only be freed once the program finishes execution and its whole memory is cleared.