GNU bug report logs - #48884
28.0.50; Possible memory leak in window-text-pixel-size (bidi cache)

Previous Next

Package: emacs;

Reported by: Daniel Martín <mardani29 <at> yahoo.es>

Date: Sun, 6 Jun 2021 21:40:02 UTC

Severity: normal

Found in version 28.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 48884 in the body.
You can then email your comments to 48884 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#48884; Package emacs. (Sun, 06 Jun 2021 21:40:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Daniel Martín <mardani29 <at> yahoo.es>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 06 Jun 2021 21:40:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Daniel Martín <mardani29 <at> yahoo.es>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; Possible memory leak in window-text-pixel-size (bidi cache)
Date: Sun, 06 Jun 2021 23:38:45 +0200
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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48884; Package emacs. (Tue, 08 Jun 2021 00:07:02 GMT) Full text and rfc822 format available.

Message #8 received at 48884 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Daniel Martín <mardani29 <at> yahoo.es>
Cc: 48884 <at> debbugs.gnu.org
Subject: Re: bug#48884: 28.0.50;
 Possible memory leak in window-text-pixel-size (bidi cache)
Date: Mon, 07 Jun 2021 15:04:28 +0300
> Date: Sun, 06 Jun 2021 23:38:45 +0200
> From:  Daniel Martín via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> 
> 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:

You are right, should be fixed now.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48884; Package emacs. (Tue, 08 Jun 2021 03:57:01 GMT) Full text and rfc822 format available.

Message #11 received at 48884 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: Daniel Martín <mardani29 <at> yahoo.es>
Cc: 48884 <at> debbugs.gnu.org
Subject: Re: bug#48884: 28.0.50;
 Possible memory leak in window-text-pixel-size (bidi cache)
Date: Mon, 07 Jun 2021 23:56:21 -0400
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

Thank you for undertaking this difficult task.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48884; Package emacs. (Wed, 09 Jun 2021 10:37:01 GMT) Full text and rfc822 format available.

Message #14 received at 48884 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 48884 <at> debbugs.gnu.org, Daniel Martín <mardani29 <at> yahoo.es>
Subject: Re: bug#48884: 28.0.50; Possible memory leak in
 window-text-pixel-size (bidi cache)
Date: Wed, 09 Jun 2021 12:36:12 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

> You are right, should be fixed now.

The report was left open, so I'm closing it now.

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




bug marked as fixed in version 28.1, send any further explanations to 48884 <at> debbugs.gnu.org and Daniel Martín <mardani29 <at> yahoo.es> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 09 Jun 2021 10:37:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48884; Package emacs. (Wed, 09 Jun 2021 11:53:02 GMT) Full text and rfc822 format available.

Message #19 received at 48884 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 48884 <at> debbugs.gnu.org, mardani29 <at> yahoo.es
Subject: Re: bug#48884: 28.0.50; Possible memory leak in
 window-text-pixel-size (bidi cache)
Date: Wed, 09 Jun 2021 14:52:40 +0300
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Cc: Daniel Martín <mardani29 <at> yahoo.es>,
>   48884 <at> debbugs.gnu.org
> Date: Wed, 09 Jun 2021 12:36:12 +0200
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > You are right, should be fixed now.
> 
> The report was left open, so I'm closing it now.

I hoped the OP will test it in the same situation where he saw the
problem...




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48884; Package emacs. (Sun, 13 Jun 2021 00:44:01 GMT) Full text and rfc822 format available.

Message #22 received at 48884 <at> debbugs.gnu.org (full text, mbox):

From: Daniel Martín <mardani29 <at> yahoo.es>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 48884 <at> debbugs.gnu.org
Subject: Re: bug#48884: 28.0.50; Possible memory leak in
 window-text-pixel-size (bidi cache)
Date: Sun, 13 Jun 2021 02:43:02 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>
> I hoped the OP will test it in the same situation where he saw the
> problem...

Sorry for the delay, I've compiled a new version of Emacs with this
patch and I don't see the memory leak anymore.  Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48884; Package emacs. (Sun, 13 Jun 2021 06:33:02 GMT) Full text and rfc822 format available.

Message #25 received at 48884 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Daniel Martín <mardani29 <at> yahoo.es>
Cc: larsi <at> gnus.org, 48884 <at> debbugs.gnu.org
Subject: Re: bug#48884: 28.0.50; Possible memory leak in
 window-text-pixel-size (bidi cache)
Date: Sun, 13 Jun 2021 09:32:41 +0300
> From: Daniel Martín <mardani29 <at> yahoo.es>
> Cc: Lars Ingebrigtsen <larsi <at> gnus.org>,  48884 <at> debbugs.gnu.org
> Date: Sun, 13 Jun 2021 02:43:02 +0200
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> >
> > I hoped the OP will test it in the same situation where he saw the
> > problem...
> 
> Sorry for the delay, I've compiled a new version of Emacs with this
> patch and I don't see the memory leak anymore.  Thanks.

Thanks for testing.  FYI: I cherry-picked the fix to the emacs-27
branch as well.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 11 Jul 2021 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 340 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.