Newsgroups: comp.lang.dylan,comp.lang.lisp,comp.lang.java
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!oitnews.harvard.edu!purdue!haven.umd.edu!news.umbc.edu!eff!news.duke.edu!news.mathworks.com!tank.news.pipex.net!pipex!uknet!newsfeed.ed.ac.uk!edcogsci!jeff
From: jeff@cogsci.ed.ac.uk (Jeff Dalton)
Subject: Re: Garbage collection cost (was Re: Parenthesized syntax challenge)
Message-ID: <DGI30H.18n@cogsci.ed.ac.uk>
Organization: Centre for Cognitive Science, Edinburgh, UK
References: <44aa9a$j5h@miso.cs.uq.edu.au>  <MARCOXA.95Oct4094304@lox.icsi.berkeley.edu> <453po8$175@Yost.com>  <LUDEMANN.95Oct6140930@expernet26.expernet.com>  <DGApp8.J41@undergrad.math.uwaterloo.ca>  <MAD.95Oct13123618@tanzanite.math.keio.ac.jp> <45q3cg$jqg@voyager.internex.net>
Date: Sun, 15 Oct 1995 17:23:45 GMT
Lines: 39
Xref: glinda.oz.cs.cmu.edu comp.lang.dylan:5415 comp.lang.lisp:19520 comp.lang.java:1646

muzok@msn.com (muzo) writes:

>mad@math.keio.ac.jp (MAEDA Atusi) wrote:
>>You must be joking.  Aside from higher programming cost (for worrying
>>about memory leak and dangling pointers), malloc/free (or new/delete)
>>is generally slower than cons/gc because cost of free is proportional
>>to the amount of objects died during computation while gc cost isn't.

>just  a sec. Are you saying that the number of free call necessary in a GC
>system is different than the number of free calls in a malloc/free program
>which allocates the same number of objects ? If yes, I'd like to see a
>reference or discussion on this.

Come on, there might be *no* calls to "free" when a GC is used.
(I say "might" because you might have both GC and some explicit
deallocation.)

>If you are not saying that (which I don't think you can), than a "perfectly
>implemented" malloc/free program has a lower bound in terms of memory
>management cost because the "programmer" (remember that person who wrote the
>perfect program ?) knows exactly when the memory is not needed anymore and
>doesn't incur any costs for finding out which objects are to be collected.

So long as Paul Wilson (and Hans Boehm) are in the business of
trying to kill myths, could they please so something about _this_
one?  The idea that malloc/free must be better because the
programmer knows exactly ... is, these days, one of the chief
weapons used against GC and indeed against entire families of
programming languages.

>I can believe that GC systems can be as fast as malloc/free systems but if
>malloc/free systems are implemented correctly and as efficiently as possible,
>there is no way a GC system can be faster than them.

You may be right, but why, exactly?  And will it be so for all
programs?

-- jd

