[gclist] What wrong with the GC in xemacs

boehm.PARC@xerox.com boehm.PARC@xerox.com
Tue, 2 Apr 1996 11:22:48 PST


Nick Barnes wrote:

"Emacs uses a stop-and-collect mark/sweep GC. It's unremarkable
stuff. Here is the controlling GC code from alloc.c in Emacs
19.30. ..."

Thanks for posting it.  A potentially easy source of improvement might be to
make it at least sweep the heap incrementally.  Does anyone know whether the
heap organization would allow that?  Unlike incremental marking, that's often
trivial.  You're only touching memory that's inaccessible to the mutator, thus
there's almost no synchronization issue.  Furthermore, by doing it
incrementally, you will probably touch the memory only just before it would be
allocated anyway, thus potentially saving a page fault.

It also looks like a recursive marker.  Depending on how it's structured, and
what the common data structures look like, that can result in very deep
recursion.  Aside from potential space problems, this is particularly
unfortunate on older SPARC machines, where it results in a register window
overflow trap on every call.

Of course, it should really use an incremental marking algorithm.

Hans