[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New GC concept

From: Andrea Corallo
Subject: Re: New GC concept
Date: Fri, 04 Jun 2021 08:56:43 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Daniel Colascione <dancol@dancol.org> writes:

> Emacs has had the same GC for a decent amount of time now (since the
> 1980s, really). I spent some time in 2020 rewriting it from scratch. I
> haven't had time to work on the new GC recently, but I figure I'd
> throw it out here to get some feedback on the general concept.
> Check out
> https://github.com/dcolascione/emacs-1/blob/newgc-wip/src/alloc.c,
> specifically the big doc comment on top
> The new GC basically replaces alloc.c and a few other things. It has a
> few cool features:
> * fully copying and compacting
> * special treatment of sxhash to preserve object identify even while
>   we move it around in memory
> * generational
> * contiguous storage of mark bits separately from the data heap
> * concurrent (in design, not current implementation): idea is that we
>   do concurrent marking and barely pause for sweep
> * small string optimization
> * bump pointer allocation of new objects
> * heap enumeration support
> * hard requirement on pdumper
> * specialized GC spaces for conses, strings, arrays, and so on: no
>   stupid header word for cons cells bloating memory use by 50%!
> * cool modern C implementation that relies heavily on compiler
>   inlining and constant propagation
> The current implementation is deficient in many ways. Honestly, I'm
> not even sure whether that specific revision compiles. But like I
> said, I haven't had time recently to continue work on it.
> Still, I'm still curious about what people think of the overall
> effort. It might work nicely with the new native compilation stuff,
> giving us a managed code execution environment kind-of, sort-of on par
> with the big modern managed-code runtimes.

Sounds cool!

The only comment I've so far is that IMO *the* important feature for a
new Emacs GC is to have it concurrent (or say concurrent as much as

Emacs user experience is often dictated by its reactivity, we need to
head towards a GC that is concurrent prioritizing in the design this
feature over others, I wouldn't mind sacrificing some efficiency for

I like the idea of a moving/generational GC but possibily porting what
we have to a tri-color mark and sweep would solve already the problem
with less impact.  This is what I would have tried if I had time.

Thanks for this work!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]