Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!apple!snorkelwacker!spdcc!merk!alliant!linus!linus!luke.mitre.org!dsr From: dsr@luke.mitre.org (Douglas S. Rand) Newsgroups: comp.lang.lisp Subject: Re: Destructors in Lisp and CLOS Message-ID: <116718@linus.mitre.org> Date: 10 Aug 90 15:06:35 GMT References: <3296@stl.stc.co.uk> Sender: usenet@linus.mitre.org Reply-To: dsr@luke.mitre.org (Douglas S. Rand) Distribution: comp.lang.lisp,uk.lisp Lines: 38 In article <3296@stl.stc.co.uk>, skp@stl.stc.co.uk (Steve Perryman ) writes: |> |>Is there a standard destructor function in Common Lisp or CLOS ??? |>There is no mention of one in Sonya Keene's book on CLOS, but is there one/ |>going to be one (in current standards etc) ?? |> Although this might be useful this is not a goal of CLOS. Also it is generally antithetical to the view of the LISP world. It is the job of the GC to clean up allocated unused storage. |> |>I have crashed my application cos it creates reams of temporary objects that |>need to be destroyed after their use, and the garbage collector cannot |>handle it. My lisp system has a destructor function but it is definitely |>non-standard and I want to use something more standard if possible. |> A possible work around to your problem is to add a personal destructor function whose job it is to place an object back on a reuse heap. You obviously need to be careful that the object really isn't in use (this is why GC is hard to write). There is a generic function reinitialize-instance which might or might not help you with cleaning the old objects. But in any case you then need to modify make-instance (allocate-instance?) for that class to grab objects off the heap before allocating a new one. |> |>Thanks in advance, |> |>Steven Perryman |>(skp@stl.stc.co.uk) Douglas S. Rand Internet: Snail: MITRE, Burlington Road, Bedford, MA Disclaimer: MITRE might agree with me - then again... Amateur Radio: KC1KJ