[Openmcl-devel] ccl:terminate doesn't seem to be working

Raffael Cavallaro raffaelcavallaro at mac.com
Fri Nov 5 11:15:00 PDT 2010


On Nov 5, 2010, at 2:08 PM, Ron Garret wrote:

> This leaks:
> 
> (defclass foo () ((p :initform (#_malloc 4096))))
> 
> (defmethod ccl:terminate ((f foo)) (#_free (slot-value f 'p)))
> 
> (loop (make-foo))
> 
> Even if you force a GC:
> 
> (loop (dotimes (i 100000) (make-foo)) (gc))
> 
> it still leaks.  But it seems like it ought not to.  Is this a bug, or am I doing something wrong?
> 
> rg
> 

You  also need an initialize-instance :after method that calls:
(ccl::terminate-when-unreachable self) on the instance (assuming you've called the instance "self" of course).

warmest regards,

Ralph


Raffael Cavallaro
raffaelcavallaro at me.com








More information about the Openmcl-devel mailing list