Subject: bug#18522: 24.4.50; mapcar is very slow

From: martin rudalics <[email-masked]>
Date: Wed, 24 Feb 2016 11:15:28 +0100

> You interpret that comment too literally: it means killed buffers that
 > were not yet GC'ed.  You will see in alloc.c that sweep_buffers
 > removes killed buffers from all_buffers and recycles their memory.

Doesn't that remove unmarked buffers only?

 >> That means, the chain gets bigger and bigger, whenever I read an article
 >> or I reply or I send a new message or whatever.
 >
 > If Emacs did that, it would have been a very serious bug and a huge
 > memory sink.

One potential hole are window configurations.  Each window maintains two
lists for navigating the buffers previously shown in that window.  For
live windows, these lists are hopefully updated when killing a buffer.
But if you store such a window in a window configuration and forget
about that configuration, the buffers from those lists are not reclaimed
IIUC.

BTW, I have no idea why FOR_EACH_BUFFER should be used outside alloc.c.

martin