[Top][All Lists]

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

Re: Let's make the GC safe and iterative

From: Stefan Monnier
Subject: Re: Let's make the GC safe and iterative
Date: Thu, 01 Mar 2018 18:38:45 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> We need to fix GC being deeply recursive once and for all. Tweaking stack
> sizes on various platforms and trying to spot-fix GC for the occasional
> deeply recursive structure is annoying. Here's my proposal:

I'm OK with making the GC loop without recursing on the C stack, but
I have two comments:
1- Don't use a queue: use a stack.  Mark&sweep naturally work with
   a stack whereas stop&copy naturally works with a queue, so in most cases
   the choice is implicit/accidental, but experience shows that if we
   can choose, the stack is the better option (e.g. there's been
   various works that try to tweak stop&copy to use a stack rather than
   a queue), for reasons of locality.
2- Why do you say "We can't allocate memory to hold the queue during GC"?
   We very well can, and doing it should make things simpler (and make
   sure we don't preallocate way too much memory).

If instead of a queue we use a stack and we just push Lisp_Object values
onto that stack, the resulting space use can't be worse than what we
have now (it's just going to use our malloc-managed stack instead of the
C stack).


reply via email to

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