GNU bug report logs -
#21556
25.0.50; Memory leak in emacs -Q with lucid (font cache cleared prematurely)
Previous Next
Reported by: Dima Kogan <dima <at> secretsauce.net>
Date: Fri, 25 Sep 2015 00:06:02 UTC
Severity: normal
Tags: moreinfo
Found in version 25.0.50
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #91 received at 21556 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Dima Kogan <dima <at> secretsauce.net> writes:
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
>> It's a long time since we last spoke about this, so maybe I've lost
>> the focus.
>
> I'm forgetting what's happening here too, so trying to finish this bug
> now.
Hi Eli. It looks like Dmitry is busy. What do you think about merging
the patch now before we both forget what this is all about? When Dmitry
gets time to comment, we can revisit. The concern wasn't that the patch
was "wrong", but rather that it maybe is a workaround for a deeper issue
instead of a fix for the issue itself.
I'm attaching the latest version of the patch. It takes Dmitry's
suggestion for avoiding an extra local variable, and adds some comments
[0001-compact_font_cache_entry-now-properly-checks-for-mar.patch (text/x-diff, inline)]
From 6a0c91e750cdab83a63f0ef03ea037b1e6d8d381 Mon Sep 17 00:00:00 2001
From: Dima Kogan <dima <at> secretsauce.net>
Date: Tue, 29 Sep 2015 02:19:35 -0700
Subject: [PATCH] compact_font_cache_entry() now properly checks for marked
fonts
* src/alloc.c (compact_font_cache_entry): When checking for marked
fonts we were looking at a font entity object. However the entity
could contain a list of font objects that need to be checked, which we
now do. This resolves a memory leak
Fixes: bug#21556
---
src/alloc.c | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/src/alloc.c b/src/alloc.c
index 3ab2a6e..2cdc581 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -5303,10 +5303,31 @@ compact_font_cache_entry (Lisp_Object entry)
are not marked too. But we must be sure that nothing is
marked within OBJ before we really drop it. */
for (i = 0; i < size; i++)
- if (VECTOR_MARKED_P (XFONT_ENTITY (AREF (XCDR (obj), i))))
- break;
+ {
+ Lisp_Object objlist;
+
+ if (VECTOR_MARKED_P (XFONT_ENTITY (AREF (XCDR (obj), i))))
+ break;
+
+ objlist = AREF (AREF (XCDR (obj), i), FONT_OBJLIST_INDEX);
+ for (; CONSP (objlist); objlist = XCDR (objlist))
+ {
+ Lisp_Object val = XCAR (objlist);
+ struct font *font = XFONT_OBJECT (val);
+
+ if (! NILP (AREF (val, FONT_TYPE_INDEX)) &&
+ VECTOR_MARKED_P(font))
+ break;
+ }
+ if (CONSP (objlist))
+ // we left the for() early because we found marked
+ // font
+ break;
+ }
if (i == size)
+ // we didn't leave the for() early because no marked fonts
+ // or entities were found.
drop = 1;
}
if (drop)
--
2.1.4
This bug report was last modified 5 years and 190 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.