Foreign objects do take up memory. If a foreign object is no longer needed, it should be deallocated using free-foreign-object. This should be done only once for each foreign object, regardless of the number of pointer objects that contain its address. After freeing a foreign object, any pointers or copies of pointers containing its address will give unpredicable results if the memory is accessed.
FLI memory is allocated using
so it comes from the C heap.
The FLI pointer object itself is a Lisp object, but the memory it points to does not show up in the output of
. Therefore you must use Operating System tools to see the virtual address size of the program.
LispWorks Foreign Language Interface User Guide and Reference Manual - 7 Dec 2011