Python vs Ruby

D-Man dsh8290 at rit.edu
Fri Jan 26 13:24:36 EST 2001


On Fri, Jan 26, 2001 at 06:15:58PM +0100, Martin von Loewis wrote:
| Greg Jorgensen <gregj at pobox.com> writes:
| 
| > According to the article below, Ruby uses a mark-and-sweep garbage
| > collector. I don't know if that is more "real" than reference counting
| > or not. 
| 
| I would certainly count mark-and-sweep as more real than reference

Of course.  Mark-and-sweep is an algorithm for Garbage Collection and
Reference Counting isn't garbage collections.  Both gc and ref
counting are forms of /Automatic Memory Management/.

I think this is where the arguments/disagreements are coming from.
Some people don't realize the difference between Automatic Memory
Management in general and the specific forms of it (namely gc).
Python doesn't do gc.

| counting; since m&s finds garbage that reference counting doesn't
| (cycles in particular). My point was that Python 2.0 does not use
| reference counting alone - it also uses an additional garbage
| collector (a generational one, of some mark-and-sweep form) to find
| cycles.

The new "gc" module doens't even do real gc.  It simply checks
for circular references in a similar manner that mark-and-sweep
collectors use.

| 
| Regards,
| Martin
| -- 

I'm not indicating here whether gc or ref counting is better, just
trying to clear the confusion with terminology.

C even has a mark-and-sweep garbage collector that works as a plug-in
replacement for malloc/free.  If you tailor your code to the collector
you can greatly improve it's performance too.  (the collector is
implemented as a library by Hans Boehm, you can find info on it in
Yahoo if you are interested)

-D





More information about the Python-list mailing list