Linus with some good observations on garbage collection

Steven Schveighoffer schveiguy at yahoo.com
Fri Apr 22 11:50:46 PDT 2011


On Fri, 22 Apr 2011 14:32:06 -0400, Alvaro <alvaro.segura at gmail.com> wrote:

> El 22/04/2011 19:36, Walter Bright escribió:
>> http://gcc.gnu.org/ml/gcc/2002-08/msg00552.html
>
> I've always been surprised when discussions usually just bring garbage  
> collection as the only alternative to explicit manual memory management.  
> I imagined it as a garbage truck that has its own schedule and may let a  
> lot of trash pile up before passing by. I always naively thought, why  
> not just free immediately when an object gets no references?

Because you then have to update potentially two reference counts every  
time you assign a pointer.  GC's save you from doing that.

I know way way less than Torvalds, but my naive brain says GC's still win  
because often times, slightly noticeable drops in performance are worth  
having code that doesn't corrupt memory.  This may not be true for kernel  
development, but then again, we aren't all developing kernels ;)

-Steve


More information about the Digitalmars-d mailing list