[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gc and deallocation
- To: email@example.com, firstname.lastname@example.org
- Subject: Re: gc and deallocation
- From: email@example.com (Doug Currie, Flavors Technology, Inc.)
- Date: Wed, 5 Jan 1994 14:58:49 -0500
At 10:15 AM 94.01.05 -0500, Thomas A. Russ wrote:
>In article <...> firstname.lastname@example.org (Bill St. Clair) writes:
> > At 10:40 PM 1/4/94 -0500, Robert Bruce Findler wrote:
> >>What happens to memory that is allocated in a clos object when the
> >>object is gc'ed? Is there a method that should be defined to clean-up
> >>after the object? Some sort of deallocate-instance?
> > When a CLOS object is garbage collected, it's memory is freed for reuse.
> > The memory of the objects in its slots will also be freed if those objects
> > are not referenced by any other live objects. MCL's garbage collector
> > does not support an explicit user-specifiable clean-up procedure.
> > You normally don't need one, though some applications, e.g. persistent
> > object databases, can benefit from such a feature.
>I would imagine that if you have pointers into the Macintosh heap that
>were stored in the CLOS object you would end up with a memory leak if
>you didn't have some disposal routine of your own. If you do this, then
>you will need to explicitly deallocate the Macintosh heap memory.
In our OODB we have used a MCL feature...
(eval-when (:compile-toplevel :execute)
(defun new-gcable-handle (size)
(let ((h (#_newhandle size)))
(when (%null-ptr-p h)
(setq h (#_newhandle size)))
(if (%null-ptr-p h)
(%setf-macptr (ccl::make-gcable-macptr ccl::$flags_DisposHandle) h))))
Handles created by new-gcable-handle in the Mac heap are gc'd just like
LISP heap objects.
I assume, since it's undocumented, that Apple does not sanction this for
general use or imply future support [Bill?].