[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#48884: 28.0.50; Possible memory leak in window-text-pixel-size (bidi
From: |
Daniel Martín |
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.
- bug#48884: 28.0.50; Possible memory leak in window-text-pixel-size (bidi cache),
Daniel Martín <=
bug#48884: 28.0.50; Possible memory leak in window-text-pixel-size (bidi cache), Richard Stallman, 2021/06/07