Newsgroups: comp.lang.dylan,comp.lang.lisp,comp.lang.java
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!oitnews.harvard.edu!yale!gumby!newsxfer.itd.umich.edu!news.mathworks.com!news.kei.com!world!moresys
From: moresys@world.std.com (MORE Systems)
Subject: Re: Garbage collection cost (was Re: Parenthesized syntax challenge)
In-Reply-To: kevin@cs.umass.edu's message of 16 Oct 1995 18:48:23 GMT
Message-ID: <MORESYS.95Oct20115647@world.std.com>
Sender: moresys@world.std.com (MORE Systems)
Organization: The World Public Access UNIX, Brookline, MA
References: <45u9dn$86i@kernighan.cs.umass.edu>
Date: Fri, 20 Oct 1995 15:56:47 GMT
Lines: 32
Xref: glinda.oz.cs.cmu.edu comp.lang.dylan:5504 comp.lang.lisp:19621 comp.lang.java:2220


I think anyone who seriously thinks that human programmers can be
better than computers at managing dynamic memory should have their
head examined...

"Nah, I don't use that garbage collection stuff, I can do it better
myself... Huh? DAMN! Another segmentation fault! I've been trying to
track that down for months! Oh well. As I was saying, garbage 
collection wastes too much time. Now if you can excuse me, I have
a lot of work to do. My project is already late..."

The REAL question is whether or not 'garbage collection', which
usually involves periodically sweeping through dynamically-allocated
memory to find unreferencable data structures, is better than the
malloc/free paradigm, which with slight alterations can be built right
into the language, requiring no programmer participation and
introducing no possibility of human error. 

Which is better? Well, on the one hand, malloc/free does require more
overhead per allocation when the cost of freeing memory is factored
in. However, garbage collection has to periodically scan through all
of dynamic memory to clean up the garbage, which on a heavily loaded
virtual-memory environment can thrash the disk like you wouldn't
believe. Each has their merits, and the jury is still out, as it were.
Until a clear winner emerges, however, it would be perfectly possible
to implement a version of Dylan, Lisp, or Java which uses either
method, a hybrid of both, or any other kind of memory allocation
scheme that anyone might come up with.  Remember, these languages only
expect that somehow the memory will be managed: It's up to the
interpereter or compiler to figure out exactly how to do it.

-Eugene (moresys@world.std.com)
