GNU bug report logs - #54698
non-recursive GC marking [PATCH]

Previous Next

Package: emacs;

Reported by: Mattias Engdegård <mattiase <at> acm.org>

Date: Sun, 3 Apr 2022 18:42:02 UTC

Severity: normal

Tags: patch

Done: Mattias Engdegård <mattiase <at> acm.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Mattias Engdegård <mattiase <at> acm.org>
Cc: luangruo <at> yahoo.com, larsi <at> gnus.org, 54698 <at> debbugs.gnu.org
Subject: bug#54698: non-recursive GC marking [PATCH]
Date: Tue, 05 Apr 2022 14:43:15 +0300
> From: Mattias Engdegård <mattiase <at> acm.org>
> Date: Tue, 5 Apr 2022 10:08:11 +0200
> Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 54698 <at> debbugs.gnu.org
> 
> 5 apr. 2022 kl. 03.15 skrev Po Lu <luangruo <at> yahoo.com>:
> 
> > What happens if it runs out of memory?
> 
> Good question! In theory the answer is simple: abort, as with any other failed xmalloc.

Emacs isn't supposed to abort when xmalloc runs out of memory.  See
memory_full.

> In practice, though, malloc probably won't fail at all -- more likely the OS will keep handing out addresses from its 64-bit space and slowly swap itself to death. On Linux, the out-of-memory killer will murder some essential processes at some point.

You mean, Emacs fails to know when it approaches the memory limit,
and/or react reasonably when memory_full is called?  That'd be a bug,
IMO.

> But it would take a lot of heap for the mark stack requirements to become that big; it's much more likely that you run out of memory allocating your Lisp objects (or something else) first.

The memory allocated for the simulated stack during GC is
_in_addition_ to what was used for Lisp objects.

> > If growing the stack fails, it aborts garbage collection and tells the
> > user to type C-x s and exit Emacs.
> 
> Frankly I wouldn't trust saving buffers to be possible when growing the mark stack wasn't. Have you actually tested this?

Emacs preserves some memory for that reason.  If that doesn't work, we
should fix it, IMO.  Being able to save your edits when memory is full
is an important safety feature in Emacs.




This bug report was last modified 2 years and 331 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.