From: Dima Kogan <dima@secretsauce.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: dmantipov@yandex.ru, 21556@debbugs.gnu.org
Subject: bug#21556: 25.0.50; Memory leak in emacs -Q with lucid (font)
Date: Sun, 08 Nov 2015 18:55:06 -0800 [thread overview]
Message-ID: <87si4fevat.fsf@secretsauce.net> (raw)
In-Reply-To: <87io5ogo8f.fsf@secretsauce.net>
[-- Attachment #1: Type: text/plain, Size: 717 bytes --]
Dima Kogan <dima@secretsauce.net> writes:
> Eli Zaretskii <eliz@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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-compact_font_cache_entry-now-properly-checks-for-mar.patch --]
[-- Type: text/x-diff, Size: 1924 bytes --]
From 6a0c91e750cdab83a63f0ef03ea037b1e6d8d381 Mon Sep 17 00:00:00 2001
From: Dima Kogan <dima@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
next prev parent reply other threads:[~2015-11-09 2:55 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-25 0:05 bug#21556: 25.0.50; Memory leak in emacs -Q with lucid (font) Dima Kogan
2015-09-25 6:45 ` Eli Zaretskii
2015-09-25 6:57 ` Dima Kogan
2015-09-25 8:44 ` Eli Zaretskii
2015-09-25 8:13 ` Dima Kogan
2015-09-25 8:49 ` Eli Zaretskii
2015-09-25 9:10 ` Eli Zaretskii
2015-09-25 9:30 ` Dima Kogan
2015-09-25 9:45 ` Eli Zaretskii
2015-09-25 10:03 ` Eli Zaretskii
[not found] ` <83y4ftfbjw.fsf@gnu.org>
2015-09-27 7:56 ` K. Handa
2015-09-27 8:09 ` Eli Zaretskii
2015-09-28 9:22 ` Dima Kogan
2015-09-28 9:58 ` Eli Zaretskii
2015-09-29 9:28 ` Dima Kogan
2015-09-30 7:00 ` Eli Zaretskii
2015-09-30 10:16 ` Dmitry Antipov
2015-10-01 9:42 ` Dima Kogan
2015-10-01 13:27 ` Dmitry Antipov
2015-10-01 18:50 ` Dima Kogan
2015-10-02 5:04 ` Dmitry Antipov
2015-10-02 18:56 ` Dima Kogan
2015-10-29 22:51 ` Dima Kogan
2015-10-30 14:20 ` Eli Zaretskii
2015-10-30 19:17 ` Dima Kogan
2015-10-30 20:38 ` Eli Zaretskii
2015-10-30 20:50 ` Dima Kogan
2015-11-09 2:55 ` Dima Kogan [this message]
2015-11-09 16:38 ` Eli Zaretskii
2019-11-17 6:34 ` Lars Ingebrigtsen
2019-11-17 15:38 ` Eli Zaretskii
2019-11-17 21:27 ` Dima Kogan
2019-11-18 8:13 ` Lars Ingebrigtsen
2015-09-29 10:05 ` K. Handa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87si4fevat.fsf@secretsauce.net \
--to=dima@secretsauce.net \
--cc=21556@debbugs.gnu.org \
--cc=dmantipov@yandex.ru \
--cc=eliz@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.