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.

Full log


View this message in rfc822 format

From: Daniel Martín <mardani29 <at> yahoo.es>
To: 48884 <at> 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
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.




This bug report was last modified 4 years and 6 days ago.

Previous Next


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