all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#48884: 28.0.50; Possible memory leak in window-text-pixel-size (bidi cache)
       [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
  2021-06-07 12:04   ` Eli Zaretskii
  2021-06-08  3:56   ` Richard Stallman
  0 siblings, 2 replies; 7+ messages in thread
From: Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-06-06 21:38 UTC (permalink / raw)
  To: 48884


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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#48884: 28.0.50; Possible memory leak in window-text-pixel-size (bidi cache)
  2021-06-06 21:38 ` bug#48884: 28.0.50; Possible memory leak in window-text-pixel-size (bidi cache) Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-06-07 12:04   ` Eli Zaretskii
  2021-06-09 10:36     ` Lars Ingebrigtsen
  2021-06-08  3:56   ` Richard Stallman
  1 sibling, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2021-06-07 12:04 UTC (permalink / raw)
  To: Daniel Martín; +Cc: 48884

> 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@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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#48884: 28.0.50; Possible memory leak in window-text-pixel-size (bidi cache)
  2021-06-06 21:38 ` bug#48884: 28.0.50; Possible memory leak in window-text-pixel-size (bidi cache) Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-06-07 12:04   ` Eli Zaretskii
@ 2021-06-08  3:56   ` Richard Stallman
  1 sibling, 0 replies; 7+ messages in thread
From: Richard Stallman @ 2021-06-08  3:56 UTC (permalink / raw)
  To: Daniel Martín; +Cc: 48884

[[[ 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)







^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#48884: 28.0.50; Possible memory leak in window-text-pixel-size (bidi cache)
  2021-06-07 12:04   ` Eli Zaretskii
@ 2021-06-09 10:36     ` Lars Ingebrigtsen
  2021-06-09 11:52       ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-09 10:36 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Daniel Martín, 48884

Eli Zaretskii <eliz@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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#48884: 28.0.50; Possible memory leak in window-text-pixel-size (bidi cache)
  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
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2021-06-09 11:52 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: mardani29, 48884

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: Daniel Martín <mardani29@yahoo.es>,
>   48884@debbugs.gnu.org
> Date: Wed, 09 Jun 2021 12:36:12 +0200
> 
> Eli Zaretskii <eliz@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...





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#48884: 28.0.50; Possible memory leak in window-text-pixel-size (bidi cache)
  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
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-06-13  0:43 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Lars Ingebrigtsen, 48884

Eli Zaretskii <eliz@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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#48884: 28.0.50; Possible memory leak in window-text-pixel-size (bidi cache)
  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
  0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2021-06-13  6:32 UTC (permalink / raw)
  To: Daniel Martín; +Cc: larsi, 48884

> From: Daniel Martín <mardani29@yahoo.es>
> Cc: Lars Ingebrigtsen <larsi@gnus.org>,  48884@debbugs.gnu.org
> Date: Sun, 13 Jun 2021 02:43:02 +0200
> 
> Eli Zaretskii <eliz@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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-06-13  6:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <m1k0n6fzbu.fsf.ref@yahoo.es>
2021-06-06 21:38 ` bug#48884: 28.0.50; Possible memory leak in window-text-pixel-size (bidi cache) Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-06-07 12:04   ` 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

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.