Re: A handful of LISP questions

Gene <gene.ressler@gmail.com>
Wed, 20 Jun 2007 06:47:39 -0700

          From comp.compilers

Related articles
A handful of LISP questions tactics40@gmail.com (tactics) (2007-06-19)
Re: A handful of LISP questions gene.ressler@gmail.com (Gene) (2007-06-19)
Re: A handful of LISP questions nmh@t3x.org (Nils M Holm) (2007-06-19)
Re: A handful of LISP questions mcr@nerdware.org (Martin Rodgers) (2007-06-19)
Re: A handful of LISP questions mal@wyrd.be (Lieven Marchand) (2007-06-19)
Re: A handful of LISP questions ahz@snafu.de (Andreas Hinze) (2007-06-19)
Re: A handful of LISP questions tactics40@gmail.com (tactics) (2007-06-20)
Re: A handful of LISP questions gene.ressler@gmail.com (Gene) (2007-06-20)
| List of all articles for this month |

From: Gene <gene.ressler@gmail.com>
Newsgroups: comp.compilers
Date: Wed, 20 Jun 2007 06:47:39 -0700
Organization: Compilers Central
References: 07-06-03307-06-046
Keywords: Lisp, GC
Posted-Date: 20 Jun 2007 20:38:30 EDT

> Let me rephrase. When garbage collecting with Mark and Sweep, you
> need a root set of objects.


Indeed! With any kind of garbage collection.


> This is the set of objects in immediate view of
> the program.


The collection of objects that might be accessed by the program at
some time in the future form a (usually disconnected) graph with
objects as nodes and pointers as edges. The root set is some set of
pointers from which each node in the graph can be reached.


> For example, the objects on the call stack or in the
> current environment.


> I guess from what people have told me on this
> list is that you call the collector at the start of the eval function
> when memory exceeds a threshold. Then, in that case, do I just flag
> everything in the current environment as being part of the root set?


Where you must look for roots depends on your implementation and
environment. It can be tricky and indeed it can depend on where you
call the collector. To your list you'll have to add implementation
language variables that may hold pointers. This is likely to include
processor registers. Depending on how you define success, just
calling gc at the start of eval has a certain lack of appeal. You can
always invent scenarios where the lisp must abort because memory is
exhausted, when a gc would allow the program to continue. Therefore
you'd like a design where gc can be called inside the allocator "just
in time" to prevent an ugly death.


Post a followup to this message

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