From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#21556: 25.0.50; Memory leak in emacs -Q with lucid (font) Date: Fri, 25 Sep 2015 12:45:11 +0300 Message-ID: <83a8saj0ig.fsf@gnu.org> References: <87d1x7e53b.fsf@secretsauce.net> <83k2rfhu93.fsf@gnu.org> <871tdmex2c.fsf@secretsauce.net> <83d1x6j339.fsf@gnu.org> <83bncqj24y.fsf@gnu.org> <87zj0adewq.fsf@secretsauce.net> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1443174405 17400 80.91.229.3 (25 Sep 2015 09:46:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 25 Sep 2015 09:46:45 +0000 (UTC) Cc: 21556@debbugs.gnu.org To: Dima Kogan Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Sep 25 11:46:34 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZfPaL-0003sB-Ip for geb-bug-gnu-emacs@m.gmane.org; Fri, 25 Sep 2015 11:46:33 +0200 Original-Received: from localhost ([::1]:53704 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZfPaK-0007QS-Om for geb-bug-gnu-emacs@m.gmane.org; Fri, 25 Sep 2015 05:46:32 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZfPZy-0007Nf-Ra for bug-gnu-emacs@gnu.org; Fri, 25 Sep 2015 05:46:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZfPZt-0007Z8-1w for bug-gnu-emacs@gnu.org; Fri, 25 Sep 2015 05:46:10 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:53552) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZfPZq-0007XM-0T for bug-gnu-emacs@gnu.org; Fri, 25 Sep 2015 05:46:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZfPZp-0004Wj-MR for bug-gnu-emacs@gnu.org; Fri, 25 Sep 2015 05:46:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 25 Sep 2015 09:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21556 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 21556-submit@debbugs.gnu.org id=B21556.144317431817331 (code B ref 21556); Fri, 25 Sep 2015 09:46:01 +0000 Original-Received: (at 21556) by debbugs.gnu.org; 25 Sep 2015 09:45:18 +0000 Original-Received: from localhost ([127.0.0.1]:42520 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZfPZ7-0004VS-Ry for submit@debbugs.gnu.org; Fri, 25 Sep 2015 05:45:18 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:62231) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZfPZ5-0004VJ-DO for 21556@debbugs.gnu.org; Fri, 25 Sep 2015 05:45:16 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0NV800H008AMHW00@a-mtaout22.012.net.il> for 21556@debbugs.gnu.org; Fri, 25 Sep 2015 12:45:07 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([84.94.185.246]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NV800H5J8F7H020@a-mtaout22.012.net.il>; Fri, 25 Sep 2015 12:45:07 +0300 (IDT) In-reply-to: <87zj0adewq.fsf@secretsauce.net> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:106901 Archived-At: > From: Dima Kogan > Cc: 21556@debbugs.gnu.org > Date: Fri, 25 Sep 2015 02:30:45 -0700 > > 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. Originally, font caches were not compacted at all until that discussion in Oct 2013; they are still not compacted now on w32. To figure out how to compact those caches correctly, I think we need to start with the basics, and understand well the "life cycle" of a font in Emacs, including its font-cache entries: when and how a font is opened and registered in the cache, when and how (and whether) it is closed and removed from the cache, etc. This stuff is notoriously under-documented in Emacs, and we no longer have active maintainers on board who are familiar with it. So I'm afraid we are on our own wrt these issues. (I'm CC'ing Handa-san, who wrote most of the font-related code, in the hope that he could chime in at some point and help us.) I can offer whatever help I can extend, which is admittedly not too much. If you have time and motivation, I suggest to start from the end: i.e., figure out when and how a font is closed and removed from Emacs. If we are lucky, perhaps the font cache compaction could be triggered by whatever triggers a font's removal from Emacs. Thanks.