Paste: From the docs

Author: slava
Mode: factor
Date: Thu, 25 Sep 2008 06:21:48
Plain Text |
The Factor garbage collector can move byte arrays around, and it is only safe to pass byte arrays to C functions if the garbage collector will not run while C code still has a reference to the data.

In particular, a byte array can only be passed as a parameter if the the C function does not use the parameter after one of the following occurs:
-  the C function returns
-  the C function calls Factor code via a callback
Returning from C to Factor, as well as invoking Factor code via a callback, may trigger garbage collection, and if the function had stored a pointer to the byte array somewhere, this pointer may cease to be valid.

If this condition is not satisfied, Manual memory management must be used instead.

New Annotation

Summary:
Author:
Mode:
Body: