realloc ( alien size -- newalien )
Factor handbook » C library interface » Passing data between Factor and C » Manual memory management

Prev:calloc ( count size -- alien )
Next:free ( alien -- )


Vocabulary
libc

Inputs
aliena c-ptr
sizea non-negative integer


Outputs
newaliena c-ptr


Word description
Allocates a new block of size bytes from the operating system. The contents of alien, which itself must be a block previously returned by malloc or realloc, are copied into the new block, and the old block is freed.

Errors
Throws an error if memory allocation failed.

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


Definition