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

From: Eli Zaretskii <[email-masked]>
Date: Fri, 25 Sep 2015 12:10:05 +0300

> Date: Fri, 25 Sep 2015 11:49:30 +0300
> From: Eli Zaretskii <[email-masked]>
> Cc: [email-masked]
> 
> > From: Dima Kogan <[email-masked]>
> > Cc: [email-masked]
> > Date: Fri, 25 Sep 2015 01:13:15 -0700
> > 
> > Hi. I just came back to this, figured out how to (semi-manually) put in
> > a watchpoint, and this watchpoint told me what's resetting the font
> > cache: the garbage collector. The backtrace in question:
> > 
> >     0x00000000005d2172 in compact_font_cache_entry (entry=24121763) at alloc.c:5313
> >     #0  0x00000000005d2172 in compact_font_cache_entry (entry=24121763) at alloc.c:5313
> >     #1  0x00000000005d221b in compact_font_caches () at alloc.c:5339
> >     #2  0x00000000005d2742 in garbage_collect_1 (end=0x7ffcdb166830) at alloc.c:5515
> >     #3  0x00000000005d2e1d in Fgarbage_collect () at alloc.c:5720
> >     #4  0x000000000054eb21 in maybe_gc () at lisp.h:4515
> >     #5  0x00000000005f638c in Ffuncall (nargs=3, args=0x7ffcdb166988) at eval.c:2584
> 
> 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.

Some additional background for these issues:

This is why the font cache compaction was introduced:

   http://lists.gnu.org/archive/html/emacs-devel/2013-10/msg00740.html

Here's one problem caused by the compaction code, and some followup
discussions with perhaps useful debug code:

   http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15876#77

This is another related bug, which eventually caused the font cache
compaction be ifdef'ed away for MS-Windows:

   http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16140