Article View: comp.lang.clos
Article #50Deleting an Instance
From: Jeff Greif
Date: Thu, 30 Jul 1992 17:31
Date: Thu, 30 Jul 1992 17:31
22 lines
1455 bytes
1455 bytes
If the classes of your instances are in the standard-class metaclass, the instances should be garbage when you relinquish all pointers to them, and the garbage collector should reclaim the storage. The implementation is broken if this doesn't happen. If your classes do instance-registration (keeping a list or all their instances, or some such), you will have to unregister all those that should disappear. If your implementation has no garbage collector, then you need to manage the instance memory yourself. You could define a new metaclass which allocates an expandable pool of raw instances for each class. You could then provide an around method on allocate-instance for this metaclass which would allocate from the pool or call the next method as necessary. Also provide a destroy method on the base class of this metaclass which returns the storage of the instance to the pool. It should get specialized by the subclasses to do other cleanup processing via :before methods. Either destroy or allocate-instance must reinitialize the slots to be unbound.
Technical Details
Message-ID:
<9207301731.AA03155@quaestor>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!inference.COM!jmgReferences:
<1992Jul30.162753.11173@athena.mit.edu>Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.clos Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!inference.COM!jmg From: jmg@inference.COM (Jeff Greif) Subject: Deleting an Instance Message-ID: <9207301731.AA03155@quaestor> Sender: jmg@inference.com Organization: Inference Corporation References: <1992Jul30.162753.11173@athena.mit.edu> Date: Thu, 30 Jul 1992 17:31:37 GMT Lines: 22