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, 30 Oct 2015 16:20:01 +0200 Message-ID: <83wpu4zbe6.fsf@gnu.org> References: <87zj082t34.fsf@gnu.org> <83io6wffm9.fsf@gnu.org> <87lhbqdhjp.fsf@secretsauce.net> <83d1x2eugp.fsf@gnu.org> <87oagl376v.fsf@secretsauce.net> <560BB690.3020804@yandex.ru> <87612q3oxj.fsf@secretsauce.net> <560D34CB.5010900@yandex.ru> <874mia2zjh.fsf@secretsauce.net> <560E106C.6010103@yandex.ru> <87r3kdguf9.fsf@secretsauce.net> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1446214888 19639 80.91.229.3 (30 Oct 2015 14:21:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 30 Oct 2015 14:21:28 +0000 (UTC) Cc: dmantipov@yandex.ru, 21556@debbugs.gnu.org To: Dima Kogan Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Oct 30 15:21:15 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 1ZsAYK-0006SX-Ki for geb-bug-gnu-emacs@m.gmane.org; Fri, 30 Oct 2015 15:21:12 +0100 Original-Received: from localhost ([::1]:50958 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZsAYK-0007BJ-4I for geb-bug-gnu-emacs@m.gmane.org; Fri, 30 Oct 2015 10:21:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59625) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZsAYF-0007BE-SF for bug-gnu-emacs@gnu.org; Fri, 30 Oct 2015 10:21:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZsAYA-0006ce-UV for bug-gnu-emacs@gnu.org; Fri, 30 Oct 2015 10:21:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:55625) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZsAYA-0006cY-RU for bug-gnu-emacs@gnu.org; Fri, 30 Oct 2015 10:21:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZsAYA-0006x0-AD for bug-gnu-emacs@gnu.org; Fri, 30 Oct 2015 10:21:02 -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, 30 Oct 2015 14:21:02 +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.144621480226633 (code B ref 21556); Fri, 30 Oct 2015 14:21:02 +0000 Original-Received: (at 21556) by debbugs.gnu.org; 30 Oct 2015 14:20:02 +0000 Original-Received: from localhost ([127.0.0.1]:46333 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZsAXB-0006vI-4W for submit@debbugs.gnu.org; Fri, 30 Oct 2015 10:20:02 -0400 Original-Received: from mtaout23.012.net.il ([80.179.55.175]:62812) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZsAX8-0006v7-Ol for 21556@debbugs.gnu.org; Fri, 30 Oct 2015 10:19:59 -0400 Original-Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0NX100L00DZEYK00@a-mtaout23.012.net.il> for 21556@debbugs.gnu.org; Fri, 30 Oct 2015 16:19:57 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([84.94.185.246]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NX100LRWEH8Q040@a-mtaout23.012.net.il>; Fri, 30 Oct 2015 16:19:57 +0200 (IST) In-reply-to: <87r3kdguf9.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:108189 Archived-At: > From: Dima Kogan > Cc: Eli Zaretskii , handa@gnu.org, 21556@debbugs.gnu.org > Date: Thu, 29 Oct 2015 15:51:38 -0700 > > Dmitry Antipov writes: > > > On 10/01/2015 09:50 PM, Dima Kogan wrote: > > > >> OK, so are you suggesting changing how mark_face_cache() works? How bad > >> is it to accept that fonts and font entities are not necessarily linked, > >> and to install the latest patch in this bug? > > > > I'm suggesting to check whether there are unmarked font objects after marking > > from Vfontset_table, and, if so, understand whether it's correct. Otherwise > > your patch, even being correct by itself, may just hide subtle GC bug. > > Hi. I looked at this again. Running the same test as before (emacs -Q, > repeatedly creating/destroying client frame) I see: > > > - entities are created with each new client frame but are /never/ > marked. > > - entity-creation backtrace is always > > #0 0x000000000060e74e in font_make_entity () at font.c:173 > #1 0x00000000006793ae in ftfont_pattern_entity (p=0xf8c180, extra=20784563) at ftfont.c:215 > #2 0x000000000067b952 in ftfont_list (f=0x13fb8c0, spec=13463989) at ftfont.c:1057 > #3 0x0000000000680de6 in xftfont_list (f=0x13fb8c0, spec=13463989) at xftfont.c:138 > #4 0x0000000000615ebc in font_list_entities (f=0x13fb8c0, spec=20978277) at font.c:2780 > #5 0x0000000000617c27 in font_find_for_lface (f=0x13fb8c0, attrs=0x7fff3ee81f50, spec=20082933, c=-1) at font.c:3262 > #6 0x0000000000617fb0 in font_load_for_lface (f=0x13fb8c0, attrs=0x7fff3ee81f50, spec=20082933) at font.c:3335 > #7 0x00000000006183a2 in font_open_by_spec (f=0x13fb8c0, spec=20082933) at font.c:3429 > #8 0x0000000000618415 in font_open_by_name (f=0x13fb8c0, name=13702436) at font.c:3440 > #9 0x000000000052fec4 in x_default_font_parameter (f=0x13fb8c0, parms=20784979) at xfns.c:2904 > #10 0x0000000000530bc2 in Fx_create_frame (parms=20784979) at xfns.c:3139 > > - Vfontset_table has fontsets and font-specs in it, but NO > font-entities. Marking from the Vfontset_table thus cannot mark any > font entities. > > Where are the entities supposed to be referenced? Does it make sense > they're never marked? It's a long time since we last spoke about this, so maybe I've lost the focus. We are discussing a problem with leaking memory, right? If font-entities are related to that, and if not marking them is the cause of the memory leak, then you are, in effect, saying that when we GC a font-entity, we should free some additional memory referenced by that font-entity, is that correct? If so, the problem is not that font-entities are not marked; that can only explain why we GC some font-entities which we shouldn't have, something that cannot possibly lead to a memory leak. Any Lisp object that is not marked will be GC'ed during the next GC cycle, so not marking intermediary short-lived objects should be fine. However, it could be that when we GC them, we forget to free some related memory that is not part of the font-entity object itself -- that could certainly lead to a leak. Does this make sense? Or did I miss something?