[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How do I destroy objects?

    Date: Wed 24 Jun 87 21:24:52-PDT
    From: Joe Karnicky <KARNICKY@Stripe.SRI.Com>

    I am programming a neural network simulation in flavors (Release 6.2).
    I implement pulses traveling through wires as follows: a wire is an
    instance of the flavor "wire".  Wires have an instance variable
    "pulses".  The value of pulses for a wire is a list of uninterned
    symbols (created by gensym).  The value of each symbol in this list is
    an object of type "pulse" and represents a pulse currently traveling
    in the wire.  Thus, when a pulse enters the wire (for example from a
    neuron) a symbol and pulse object are created.    When the pulse
    subsequently leaves the wire I remove its symbol from the pulses
    list and everything simulates fine.   However, I'm concerned about
    the fact that I'm accumulating a large number of useless pulse
    objects.   Any suggestions about the correct way to turn these
    into garbage?


 From your description, GC should have no problem with your data
structure.  If it is not collecting your objects, then you must be
keeping pointers around to them.  There are unfortunately no tools to do
this, other than careful examination of your code.  I would suggest
doing this.  (Look for all places which store pulse objects and ask
yourself if that reference is kept around.)

It is possible that the lifetimes of your objects are so long that
ephemeral GC will not be able to collect all of them.  If that is the
case, you will have to use dynamic GC occasionally.  Alternatively you
could alter the ephemeral GC properties of WORKING-STORAGE-AREA by doing
	   :N-LEVELS ??
	   :CAPACITY ??
I don't suggest doing this without first enabling and examining
ephemeral GC reports to see if twiddling these knobs will really help.