malloc-byte-array ( byte-array -- alien )
Factor handbook » C library interface » Passing data between Factor and C » Manual memory management

Next:malloc ( size -- alien )


Vocabulary
alien.data

Inputs
byte-arraya byte-array


Outputs
alienan alien


Word description
Allocates an unmanaged memory block of the same size as the byte array, and copies the contents of the byte array there.

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


Errors
Throws an error if memory allocation fails.

Definition