Article View: comp.lang.clos
Article #338Re: How to neatly destroy instances?
From: William Clinger
Date: Wed, 14 Oct 1992 07:15
Date: Wed, 14 Oct 1992 07:15
33 lines
2207 bytes
2207 bytes
I think it is intuitively obvious that for most such structures the
application is in a far better position to know when the structure will
be of no further use.
Whether obvious or not, I don't think this is true. In complex
applications with shared data structures, the only way the application
can know when a structure will be of no further use is by maintaining
some kind of reference count, or by implementing a custom garbage
collector. Automatic garbage collection is more reliable, and is
usually faster as well because more programming effort can be justified
for a general-purpose collector than for a single-purpose collector.
...A substantial portion of the time to GC isn't
sticking cons cells back on the free list, but deciding which ones need
to be so stuck. So I still claim having an explicit free (or at least
some amount of low-level control on memory allocation, WHEN NEEDED AND
APPROPRIATE) would be 'a good thing'.
At best, explicit deallocation takes time proportional to the number
of nodes being freed. Modern garbage collectors can and often do
operate in less time than explicit deallocation, because they use
algorithms whose time is proportional to the number of nodes that
are live in heuristically chosen regions that have a low percentage
of live data.
Your argument is similar to the argument that explicit storage
overlays will always outperform automatic paging. Garbage
collection has a theoretical advantage over explicit deallocation,
however, so the case for garbage collection is even stronger than
was the case for automatic paging.
William Clinger
Technical Details
Message-ID:
<9210142115.AA04377@skinner.cs.uoregon.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!ogicse!usenet.coe.montana.edu!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!skinner.cs.uoregon.edu!willShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!usenet.coe.montana.edu!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!skinner.cs.uoregon.edu!will From: will@skinner.cs.uoregon.edu (William Clinger) Newsgroups: comp.lang.clos Subject: Re: How to neatly destroy instances? Message-ID: <9210142115.AA04377@skinner.cs.uoregon.edu> Date: 14 Oct 92 07:15:51 GMT Article-I.D.: skinner.9210142115.AA04377 Sender: daemon@cis.ohio-state.edu Organization: The Ohio State University Department of Computer and Information Science Lines: 33