malloc ( size -- alien ) (original) (raw)

Vocabulary
libc

Inputs

size a non-negative integer

Outputs

alien a c-ptr

Word description
Allocates a block of size bytes from the operating system. The contents of the block are undefined.

Errors
Throws an error if memory allocation failed.

Warning
Don't forget to deallocate the memory with a call to free.

Definition

USING: libc.private ;

IN: libc

: malloc ( size -- alien ) (malloc) check-ptr add-malloc ;