资 源 简 介
garbage-pools is Common Lisp re-implementation the APR Pools for resource management.
API
pool
The fundamental pool type.
with-garbage-pool ((&optional (var "*pool*)) &body body)
Performs a series of operations on pool. Return the values returned by the body. Possible use named and unnamed pools.
(with-garbage-pool () (cleanup-register myobj clenup-fun))
(with-garbage-pool (mypool) (cleanup-register myobj clenup-fun mypool))
cleanup-register (object cleanup-fun &optional (pool *pool*))
Register a function to be called when a pool is cleared. Return object.
(with-garbage-pool () (cleanup-register (cffi:foreign-string-alloc "Hello world") #"cffi:foreign-string-free) ...)
cleanup-pool