Re: Compile Time Garbage Collection impossible?

glen herrmannsfeldt <gah@ugcs.caltech.edu>
30 Sep 2006 17:42:52 -0400

          From comp.compilers

Related articles
[10 earlier articles]
Re: Compile Time Garbage Collection impossible? liekweg@ipd.info.uni-karlsruhe.de (Florian Liekweg) (2006-09-26)
Re: Compile Time Garbage Collection impossible? alewando@fala2005.com (A.L.) (2006-09-28)
Re: Compile Time Garbage Collection impossible? torbenm@app-3.diku.dk (2006-09-28)
Re: Compile Time Garbage Collection impossible? sleepingsquirrel@yahoo.com (Greg Buchholz) (2006-09-28)
Re: Compile Time Garbage Collection impossible? bobduff@shell01.TheWorld.com (Robert A Duff) (2006-09-30)
Re: Compile Time Garbage Collection impossible? danwang74@gmail.com (Daniel C. Wang) (2006-09-30)
Re: Compile Time Garbage Collection impossible? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2006-09-30)
Re: Compile Time Garbage Collection impossible? int2k@gmx.net (Wolfram Fenske) (2006-09-30)
Re: Compile Time Garbage Collection impossible? scgupta@yahoo.com (Satish Chandra Gupta) (2006-10-03)
Re: Compile Time Garbage Collection impossible? oliver@first.in-berlin.de (Oliver Bandel) (2006-10-08)
| List of all articles for this month |
From: glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups: comp.compilers
Date: 30 Sep 2006 17:42:52 -0400
Organization: Compilers Central
References: 06-09-119 06-09-146
Keywords: GC
Posted-Date: 30 Sep 2006 17:42:52 EDT

A.L. wrote:


(snip)


> Determining what objects could be deallocated during compilation is
> equivalent to "halting problem" that is undecidable. i.e. there is
> no algorithm possible that could do this for all possible programs.


I don't disagree, but determining deallocation at run-time isn't so
easy, either.


In addition to circular linked lists, which as already mentioned are a
problem for reference count GC, there is memory allocated in main and
not referenced later. Those two are often indicated in Java
documentation. Consider in the main program:


double x[]=new double[100000000];
/* use x here, but never again */
/* long and complicated code goes here */


Now, throughout the rest of the program that array will remain
allocated as it is in scope. It might even be that a compile time GC
would know that there are no more references, and no path back to code
that does reference x, but at run time there is no way to know.


-- glen


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.