Subject: Re: bug#21556: 25.0.50; Memory leak in emacs -Q with lucid (font)

From: Eli Zaretskii <[email-masked]>
Date: Mon, 28 Sep 2015 12:58:30 +0300

> From: Dima Kogan <[email-masked]>
> Cc: "K. Handa" <[email-masked]>, [email-masked], [email-masked]
> Date: Mon, 28 Sep 2015 02:22:50 -0700
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> > So maybe we should simply remove (or ifdef away) the code that
> > compacts the font caches.  If your assumption about reusing the font
> > is anywhere near the truth, compacting the font cache gives us more
> > trouble than it gains: we get slow redisplay in some cases and random
> > hard-to-debug bugs, while the gains are only visible in very rare use
> > cases such as the one described in the Oct 2013 discussion.
> 
> Hi. I put in some more probes, and it looks like the fonts aren't being
> marked as used properly. I also wrote a bit of code to make the gc
> actually free fonts it drops. Unsurprisingly, this causes things to
> crash, since it then frees fonts that are actually in use. Does it make
> sense to track down why the fonts aren't marked as used? If the
> compaction code goes away, then it doesn't really matter.

It depends on how much time and energy do you have.  I think it would
be nice to understand where and how do we mark used fonts, if only to
document that and make sure we don't miss anything.  However, my
personal preference is to remove the cache compaction, unless we hear
some good reasons from Dmitry, and some ideas for how to fix the
leaks.

So, if you prefer not to invest any time in investigating the font
marking code, let's wait for Dmitry to respond, and make the decision
when he does (or when we give up waiting).

Thanks.