[Search for users]
[Overall Top Noters]
[List of all Conferences]
[Download this site]
Title: | Languages |
Notice: | Speaking In Tongues |
Moderator: | TLE::TOKLAS::FELDMAN |
|
Created: | Sat Jan 25 1986 |
Last Modified: | Wed May 21 1997 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 394 |
Total number of notes: | 2683 |
204.0. "Garbage collection in a multi-lingual environment?" by MJG::GRIER (In search of a real name...) Thu Oct 13 1988 18:02
Anyone with comments on garbage collection in a multi-lingual
environment? I'm playing with an object system on my PC at home, and
I'm trying to figure out what to do about GC. I just asked in the Ada
conference about GC there, because I know they've been thinking about
doing GC in Ada for a while. Seems to me that unless you've a really
good handle on usage of addresses, you just plain can't do GC.
Thus in practically-untyped languages like C and BLISS, automatic GC
is pretty much a dream. LISP and Owl seem to be able to handle it
because the languages are in full control of object instances.
So, the best I've been able to come up with would a system where
each object would keep a tally of "references" to the object, with
well-behaved clients of the system performing calls to indicate that
they are/are not accessing the object, and when the access count drops
to zero, the object is free to be deallocated.
However, I don't feel that that's significantly better than manual
deallocation/destruction.
Consider the idealized C code fragment:
{
MyReal = CreateReal ();
SetRealValue (MyReal, 6.5);
MultiplyReal (MyReal, RealConstant(2.0), MyReal);
}
Where RealConstant(x) was a constructor for a constant object of
class Real. That would have to become...
{
RealObject TempConstant;
MyReal = CreateReal ();
SetRealValue (MyReal, 6.5);
TempConstant = RealConstant(2.0);
MultiplyReal (MyReal, TempConstant, MyReal);
DestroyReal (&TempConstant);
}
or possibly something much worse.
I'll eventually try to discuss the object-oriented aspects of this
all in the OBJECT_ORIENTED conference, but I wanted to get a
cross-lingual opinion.
-mjg
T.R | Title | User | Personal Name | Date | Lines |
---|
204.1 | | AITG::VANROGGEN | | Thu Oct 13 1988 23:09 | 20 |
| VAX LISP V3.0 will have a method of collecting non-lisp objects
given the assumption that there are no external references to
objects which the lisp system thinks has become garbage. The
idea is to garbage collect things like windows by having a lisp
object representing the window. When the lisp system thinks
the window can be reclaimed, a finalization routine may be run,
which in this case would presumably delete the window and do
any other necessary bookkeeping.
Handling cases where there may be uncontrolled references to
objects is a much more difficult problem. I don't know of any
good solutions. One general technique is to search for possible
pointers (or derived pointers due to pointer arithmetic) and
conservatively leave the corresponding objects in place, uncollected.
However, this can be quite slow and may cause huge memory "leaks",
since there is no guarantee on there being no fake "pointer" to
a large data structure that is actually garbage. See Joel
Bartlett's work at WRL on GC with Ambiguous Roots.
---Walter
|
204.2 | Reference counts don't work on graphs with cycles | DENTON::AMARTIN | Alan H. Martin | Mon Oct 17 1988 11:47 | 11 |
| Keeping reference counts in objects doesn't help garbage collection of sets of
objects which are unreachable, but which refer to each other. Such objects have
non-zero reference counts, yet are worthy of being reclaimed.
Do you subscribe to SIGPLAN Notices? If not, you should sign up ASAP. You'd go
nuts over the infinite thermal sea of language ideas that it contains every
month.
/AHM
P. S. If you need an ACM membership application, send me mail. Maybe I can use
you to get my "snare a friend" dragon coffee mug...
|