Note that memory allocated by ffi_closure_alloc
and freed by
ffi_closure_free
does not come from the same general pool of
memory that malloc
and free
use. To accomodate security
settings, libffi
may aquire memory, for example, by mapping
temporary files into multiple places in the address space (once to
write out the closure, a second to execute it). The search follows
this list, using the first that works:
memfd_create()
, if the kernel supports it.
LIBFFI_TMPDIR
.
TMPDIR
.
/tmp
.
/var/tmp
.
/dev/shm
.
$HOME
).
/etc/mtab
.
/proc/mounts
.
If security settings prohibit using any of these for closures,
ffi_closure_alloc
will fail.