Next: , Previous: Basic Pointer Operations, Up: Pointers


7.2 Allocating Foreign Memory

CFFI provides support for stack and heap C memory allocation. Stack allocation, done with with-foreign-object, is sometimes called “dynamic” allocation in Lisp, because memory allocated as such has dynamic extent, much as with let bindings of special variables.

This should not be confused with what C calls “dynamic” allocation, or that done with malloc and friends. This sort of heap allocation is done with foreign-alloc, creating objects that exist until freed with foreign-free.