Ruby implementation Q's

Well, how do other languages implement GC? Which language, in your opinion,
has the best form of garbage collection? I only know a little bit about
GC, and then only with regards to Perl and Ruby. I have no idea how C, C++,
Java, Smalltalk, OCaml, Lisp, etc handle GC behind the scenes.

Regards,

Dan

···

-----Original Message-----
From: Justin Johnson [mailto:justinj@mobiusent.com]
Sent: Wednesday, July 03, 2002 12:54 PM
To: ruby-talk@ruby-lang.org
Subject: Re: Ruby implementation Q’s

I agree it is interesting. But you will not see it in (my) Ruby in
the near future. I have to consider it more deeply, since I have
some concerns about implementation / language impact of the idea.

I’m not suggesting it as a request for the current Ruby. I
mention the idea
because it is an interesting thought and because I’m
developing another
implementation of the language.
I think that introducing manual deletion into a language like Ruby may
create an inbalance and have an adverse effect on code design.

If I could just come up with a way of (quickly) detecting the
moment an
object isn’t referenced anymore…

Well, how do other languages implement GC? Which language, in your
opinion,
has the best form of garbage collection? I only know a little bit about
GC, and then only with regards to Perl and Ruby. I have no idea how C,
C++,
Java, Smalltalk, OCaml, Lisp, etc handle GC behind the scenes.

Perl and Python use reference counting in combination with a mark-and-sweep
to reclaim cyclic reference garbage. C and C++ have only manual
allocation/destruction by default but libraries are available to provide
various flavours of garbage collection.

Not sure about Java GC, but it runs on a seperate thread as an incremental
(mark-and-sweep?) process. Generational garbage collectors are popular with
Smalltalk and Lisp, although historically both have used reference counting.
BETA uses the train algorithm, a twist on generational collecting.

There are many, many variations and mixtures. It’s quite a diverse field.

Which ones are actually better largely depends on the implementation details
and tuning.

···


Justin Johnson
justinj@mobiusent.com
Technical Director
Mobius

This isn’t true for perl. Perl uses a pure refcount scheme, with a
walk of the arenas at the end of a program for forced destruction. No
mark and sweep. (Python’s got a more complex scheme which is
generating some interesting discussion on the python-dev list at the
moment, but I’m unfamiliar enough with it to say anything definitive)

···

At 3:54 AM +0900 7/4/02, Justin Johnson wrote:

Well, how do other languages implement GC? Which language, in your
opinion,
has the best form of garbage collection? I only know a little bit about
GC, and then only with regards to Perl and Ruby. I have no idea how C,
C++,
Java, Smalltalk, OCaml, Lisp, etc handle GC behind the scenes.

Perl and Python use reference counting in combination with a mark-and-sweep
to reclaim cyclic reference garbage. C and C++ have only manual
allocation/destruction by default but libraries are available to provide
various flavours of garbage collection.


Dan

--------------------------------------“it’s like this”-------------------
Dan Sugalski even samurai
dan@sidhe.org have teddy bears and even
teddy bears get drunk