[plt-scheme] Re: history of stack and heap.

From: Shriram Krishnamurthi (sk at cs.brown.edu)
Date: Mon Apr 27 19:01:19 EDT 2009

> I don't have a formal CS background and so this intrigues me.
> It almost looks like after the advent of the term "garbage
> collection",
> which I believe happened after stacks came to be, did all forms of
> resource cleanup end up being looked upon as types of GC?

GC is simply a canonical example of resource cleanup.  The stack is
too specialized, since it has limited longevity.  General GC, in
contrast, has to deal with free-form data structures.  Therefore, "GC"
is a useful shorthand for dealing with management of resources.

Note that this term can be applied *too* widely and hence incorrectly,
namely to the management of *scarce* resources.  Scarcity is a problem
for traditional GC because it assumes that though finite, the resource
in question (memory) is still "plentiful".  In contrast, PLT Scheme's
custodians, for instance, help with this other form of "GC".

> If you look at it more specifically as "garbage collection
> of the program store" where the program store usually refers
> to a heap, I found the chicken scheme implementation interesting
> in that it used the stack more or less equally as a program store
> as well.

I'm sure you don't mean what you wrote, because programming language
implementations have *always* used to stack as a store.  The problem
is when they confuse scope and extent, as C does.  You can use
something like Henry Baker's "Cheney on the MTA" scheme to get around
some of these issues, and that may be what Chicken does.

What is interesting is using the store for the stack.  This is what
Appel's Standard ML implementation (SML/NJ) pioneered.  See Appel's
too-correctly-and-hence-misleadingly-named "Compiling with
Continuations" for more.

Shriram


Posted on the users mailing list.