all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Gerd Möllmann" <gerd.moellmann@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org,  eller.helmut@gmail.com
Subject: Re: MPS: struct window, prev_buffers + next_buffers
Date: Sat, 22 Jun 2024 10:13:33 +0200	[thread overview]
Message-ID: <m2pls94cpe.fsf@pro2.fritz.box> (raw)
In-Reply-To: <861q4pjtn4.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 22 Jun 2024 10:58:39 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Gerd Möllmann <gerd.moellmann@gmail.com>
>> Cc: Eli Zaretskii <eliz@gnu.org>, Helmut Eller <eller.helmut@gmail.com>
>> Date: Sat, 22 Jun 2024 09:24:59 +0200
>> 
>> 1. Does igc really have to do something? I don't see something
>> noticeably growing, even after hours of using Emacs with igc.
>
> How many buffers did that session create and delete?  Do you see
> killed buffers not collected (i.e. buffer objects whose name is nil
> that are not garbage-collected because the window's prev_buffers or
> next_buffers list references those killed buffers?  That's what the
> comment in mark_window says:

How many buffers get killed is hard to tell. I have usually 50-100 file
buffers, which are kind of long-lived, plus constantly temp buffers (I
guess) that are created by vertico and alike.

I've not noticed that the number of buffers increases noticeably. There
is always some variation that I would expect from conservative roots, of
course, control stack and alike.

Maybe it's because windows aren't long-lived? No idea.

>
>   /* Filter out killed buffers from both buffer lists
>      in attempt to help GC to reclaim killed buffers faster.
>      We can do it elsewhere for live windows, but this is the
>      best place to do it for dead windows.  */
>   wset_prev_buffers
>     (w, mark_discard_killed_buffers (w->prev_buffers));
>   wset_next_buffers
>     (w, mark_discard_killed_buffers (w->next_buffers));
>
>> 2. Is it an option to leaving these lists alone in GC?
>
> Isn't this the same question as 1, just IOW?

Maybe :-)

>> 3. If igc should do something, how frequently? IOW what makes these
>> lists grow? And perhaps could we do this cleanup where new entries are
>> pushed onto them?
>
> The growth of these lists is not the problem, I think.  The problem is
> that they reference killed buffers, and that prevents those killed
> buffers from being GCed.
>
>> 4. Note that the loop in the function stops when a cons cell is marked.
>> So it doesn't always take entries off the list that contain dead
>> buffers. I don't understand that at all.
>
> I guess the cons cell being marked means that someone has a reference
> to it, and therefore it cannot be GCed?

But it won't be GC'd anyway, becuase it's marked. And if the buffer in
the cons is killed, it remains in the list. That makes no sense to me.




  reply	other threads:[~2024-06-22  8:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-22  7:24 MPS: struct window, prev_buffers + next_buffers Gerd Möllmann
2024-06-22  7:58 ` Eli Zaretskii
2024-06-22  8:13   ` Gerd Möllmann [this message]
2024-06-22  8:24     ` Eli Zaretskii
2024-06-22  8:53       ` Gerd Möllmann
2024-06-22  9:50         ` Eli Zaretskii
2024-06-22 10:25           ` Gerd Möllmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2pls94cpe.fsf@pro2.fritz.box \
    --to=gerd.moellmann@gmail.com \
    --cc=eliz@gnu.org \
    --cc=eller.helmut@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.