Subject: Re: bug#53348: 27.2; Crash in mark_object

From: Lars Ingebrigtsen <[email-masked]>
Date: Fri, 21 Jan 2022 11:34:25 +0100

Eli Zaretskii <[email-masked]> writes:

> Yes, GC is very recursive, although it shouldn't cause stack overflow
> with "usual" data structure.  No, a long list shouldn't cause such
> deep recursion, but a deeply-recursive list or some other recursive
> data structure could, if the depth is unusually large.

In particular, the gc is recursive on the `car' of cons cells.  The
following trivial code should segfault Emacs (so don't evaluate it):

(let ((foo (cons 1 1)))
  (dotimes (i 1000000)
    (setcar foo (cons 1 1))
    (setq foo (car foo))))
(garbage-collect)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no