From: "Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 48884@debbugs.gnu.org
Subject: bug#48884: 28.0.50; Possible memory leak in window-text-pixel-size (bidi cache)
Date: Sun, 06 Jun 2021 23:38:45 +0200 [thread overview]
Message-ID: <m1k0n6fzbu.fsf@yahoo.es> (raw)
In-Reply-To: m1k0n6fzbu.fsf.ref@yahoo.es
I'm investigating how Emacs handles memory and I think I've found a
memory leak in window-text-pixel-size. This function is called by
minibuffer completion packages like selectrum or vertico, so even if
each leak is around 7,5 KB per minibuffer interaction on my system,
users interact a lot with the minibuffer in a typical Emacs session, so
the amount of leaked memory may be substantial if an Emacs session spans
weeks.
I don't have a minimum program to reproduce it yet, but here's what I see
when I trace the code when I use one of the aforementioned packages:
In line 10775 of xdisp.c, SAVE_IT allocates some data and makes it2data
point to it.
if (IT_CHARPOS (it) > end) returns false
if (!NILP (x_limit)) returns false
if (it.current_y > start_y) returns true and sets start_x = 0;
if (y > max_y) returns false
if (EQ (mode_and_header_line, Qtab_line) || EQ (mode_and_header_line,
Qt)) returns false. The same for the header line and mode line.
bidi_unshelve_cache (itdata, false) unshelves the cache pointed by
itdata (not it2data).
if (old_b) returns false
The function exits and the pointer variable it2data goes out of scope,
leaking the memory it points to.
Thanks.
next parent reply other threads:[~2021-06-06 21:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <m1k0n6fzbu.fsf.ref@yahoo.es>
2021-06-06 21:38 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2021-06-07 12:04 ` bug#48884: 28.0.50; Possible memory leak in window-text-pixel-size (bidi cache) Eli Zaretskii
2021-06-09 10:36 ` Lars Ingebrigtsen
2021-06-09 11:52 ` Eli Zaretskii
2021-06-13 0:43 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-06-13 6:32 ` Eli Zaretskii
2021-06-08 3:56 ` Richard Stallman
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m1k0n6fzbu.fsf@yahoo.es \
--to=bug-gnu-emacs@gnu.org \
--cc=48884@debbugs.gnu.org \
--cc=mardani29@yahoo.es \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).