bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#54698: non-recursive GC marking [PATCH]


From: Mattias Engdegård
Subject: bug#54698: non-recursive GC marking [PATCH]
Date: Sun, 3 Apr 2022 20:40:57 +0200

The GC uses recursion to traverse data structures for marking which imposes a 
limit to how big (or deeply nested) Lisp data structures can be, and usually 
results in an immediate Emacs crash without warning when that limit is exceeded.

The attached patch replaces recursion with an explicit stack for most common 
object types: conses, vectors, records, hash tables, symbols, functions etc. 
Recursion remains for some less common types (buffers, frames etc) but these 
are typically not used in quantities to cause a problem.

A side benefit is that GC becomes quite a bit faster as a result. Actual 
workloads such as byte-compilation are consequently sped up by a small but 
measurable amount.

The patch is explicitly unfinished in some uninteresting respects to make it 
easier to read; `process_mark_stack` needs reindenting.

Attachment: gc-mark-stack.diff
Description: Binary data


reply via email to

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