Subject: bug#79200: 31.0.50; Duplicated elements for '#<marker at' in buffer-undo-list

From: Alan Mackenzie <[email-masked]>
Date: Mon, 11 Aug 2025 16:35:22 +0000

Hello, Eli.

On Mon, Aug 11, 2025 at 19:20:43 +0300, Eli Zaretskii wrote:
> > Cc: Gerd Möllmann <[email-masked]>,
> >  Óscar Fuentes <[email-masked]>, [email-masked],
> >  Stefan Monnier <[email-masked]>, [email-masked]
> > Date: Mon, 11 Aug 2025 15:48:13 +0000
> > From: Alan Mackenzie <[email-masked]>

> > Fread_from_minibuffer just calls read_minibuf.  By perusing the source,
> > it seems that two of the three repeating markers are created in
> > save_window_save, called from Fcurrent_window_configuration (which is
> > called from read_minibuf).

> > With a bit of refactoring, we could arrange for (at least) two of these
> > three regularly created markers to be nullified.  This would be tedious
> > rather than difficult.

> Why aren't they collected by GC?

They are, eventually.

But my hypothesis is that between GC runs many hundreds of useless
markers clog up the buffer's list of markers, and these in turn clog up
the OP's (Óscar's) undo list.

And that if we could reduce the number of useless live markers we leave
to GC, we could resolve the OP's problem.  It may even be that the vast
numbers of markers we suspect get created are slowing Emacs down
noticeably, though there's no firm evidence for this at the moment.

-- 
Alan Mackenzie (Nuremberg, Germany).