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

From: Dima Kogan <[email-masked]>
Date: Fri, 25 Sep 2015 02:30:45 -0700

Eli Zaretskii <[email-masked]> writes:

>> cache: the garbage collector. The backtrace in question:
>> 
>>     0x00000000005d2172 in compact_font_cache_entry (entry=24121763) at alloc.c:5313
>
> Yes, that's what I wrote to you you meanwhile.
>
> This seems to mean that fonts whose entries in the cache are not
> marked are still being used, or are unused but not freed.

You called it exactly.

> Some additional background for these issues:

Thanks. Very useful.

I guess I still don't know if the fonts are supposed to be marked or
not. They appear to never be marked. Do you know where that is supposed
to happen?

Furthermore, the compaction code is incomplete, at least for xft. Xft
refence-counts the fonts, so you must close all fonts you have opened.
Emacs stores the fonts that have been opened in the cache, so if it ever
drops any fonts from the cache, it must tell xft to close, or else
things leak, as we're seeing. I haven't tried to do this yet, but I
suspect that the fonts should be marked, otherwise we'd be closing the
font that we have just opened.