GNU bug report logs - #21556
25.0.50; Memory leak in emacs -Q with lucid (font cache cleared prematurely)

Previous Next

Package: emacs;

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


View this message in rfc822 format

From: Dima Kogan <dima <at> secretsauce.net>
To: Dmitry Antipov <dmantipov <at> yandex.ru>
Cc: handa <at> gnu.org, Eli Zaretskii <eliz <at> gnu.org>, 21556 <at> debbugs.gnu.org
Subject: bug#21556: 25.0.50; Memory leak in emacs -Q with lucid (font)
Date: Thu, 01 Oct 2015 02:42:32 -0700
Dmitry Antipov <dmantipov <at> yandex.ru> writes:

> On 09/29/2015 12:28 PM, Dima Kogan wrote:
>
>> I found and fixed the bug, and the patch is attached. The issue was
>> that the compaction code wasn't checking all the right lisp objects
>> for the marks. The font entities were storing a list of fonts, and
>> this list had to be traversed, looking for the marks.
>
> In general, this patch hits the case where the font object is marked but the
> corresponding font entity is not; but is that legal? IIRC Emacs asks the font
> driver to find a font described by font spec, and returned object is a font entity,
> which is a list of font objects plus some extra stuff. Thus, there should be
> no "free-floating" font objects, i.e. for each font object, there should be
> at least one font entity object which references that font. IOW, having
> marked font object without marked font entity looks like GC mark bug for me.

OK. The target of the patch is as you describe: fonts marked inside an
unmarked entity. I'm observing this situation every time from an emacs
-Q. The font is marked inside mark_face_cache(), which looks like this:


   NO_INLINE /* To reduce stack depth in mark_object.  */
   static void
   mark_face_cache (struct face_cache *c)
   {
     if (c)
       {
         int i, j;
         for (i = 0; i < c->used; ++i)
           {
             struct face *face = FACE_FROM_ID (c->f, i);

             if (face)
               {
                 if (face->font && !VECTOR_MARKED_P (face->font))
                   mark_vectorlike ((struct Lisp_Vector *) face->font);

                 for (j = 0; j < LFACE_VECTOR_SIZE; ++j)
                   mark_object (face->lface[j]);
               }
           }
       }
   }


Clearly in this function we mark the font. We don't obviously mark the
containing entity, unless it's one of the face->lface[] elements. If
even in this case we're supposed to be marking the entity, where would
this be?




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.