From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dima Kogan Newsgroups: gmane.emacs.bugs Subject: bug#21556: 25.0.50; Memory leak in emacs -Q with lucid (font) Date: Thu, 01 Oct 2015 02:42:32 -0700 Message-ID: <87612q3oxj.fsf@secretsauce.net> 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> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1443710560 23416 80.91.229.3 (1 Oct 2015 14:42:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 1 Oct 2015 14:42:40 +0000 (UTC) Cc: 21556@debbugs.gnu.org To: Dmitry Antipov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Oct 01 16:42:27 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 1Zhf3q-0007iD-P0 for geb-bug-gnu-emacs@m.gmane.org; Thu, 01 Oct 2015 16:42:19 +0200 Original-Received: from localhost ([::1]:51132 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zhf3p-0002Og-VN for geb-bug-gnu-emacs@m.gmane.org; Thu, 01 Oct 2015 10:42:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41829) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhaOI-0007oQ-7Y for bug-gnu-emacs@gnu.org; Thu, 01 Oct 2015 05:43:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZhaOE-00087f-L4 for bug-gnu-emacs@gnu.org; Thu, 01 Oct 2015 05:43:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60940) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhaOE-00087W-HS for bug-gnu-emacs@gnu.org; Thu, 01 Oct 2015 05:43:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZhaOE-0007ud-B9 for bug-gnu-emacs@gnu.org; Thu, 01 Oct 2015 05:43:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dima Kogan Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 01 Oct 2015 09:43: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.144369256030381 (code B ref 21556); Thu, 01 Oct 2015 09:43:02 +0000 Original-Received: (at 21556) by debbugs.gnu.org; 1 Oct 2015 09:42:40 +0000 Original-Received: from localhost ([127.0.0.1]:49911 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZhaNr-0007tw-Qm for submit@debbugs.gnu.org; Thu, 01 Oct 2015 05:42:40 -0400 Original-Received: from out1-smtp.messagingengine.com ([66.111.4.25]:33118) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZhaNp-0007tn-S6 for 21556@debbugs.gnu.org; Thu, 01 Oct 2015 05:42:38 -0400 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 48B7D2030C for <21556@debbugs.gnu.org>; Thu, 1 Oct 2015 05:42:34 -0400 (EDT) Original-Received: from frontend2 ([10.202.2.161]) by compute2.internal (MEProxy); Thu, 01 Oct 2015 05:42:34 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=secretsauce.net; h=cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=0wj47 6Nr/95hIymGmil3r1eshio=; b=Jer463brPm307t7jTExNxvoMGi/qVVOSPI5Zz CX7GlRc+zf6xBTRnyKTEotXLZQ3gJMl+k8Sg/hB0KJEzS8fXicounFN9shgByxXt gZ1WIJbz0gJZ6D57hKyBaWrr+nzb68w1VVIDIkuYB/fjH6a7ivZnxk6PIUehLvQT y6uQ+s= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=0wj476Nr/95hIymGmil3r1eshio=; b=CI4M0 N8KVmbvN+jWvuXdM/GXvUUREU2KDeT8VZqMlWCeWdLXG0h8MwxlLOZxQVgDUCsJt c5lSqY4M7tDxzRpmpyZIunefa22ZQgxiOPmay5UZh+HK7lL6JZWyF05aCarBTsp2 Cq4Q6nDM69ChfTPBDhlprN9ymnKhTwGcY9SuBQ= X-Sasl-enc: cBxw5RPbTfh+hK5zru3RCCZ3lImBMEEpdsOMySLBJVtV 1443692554 Original-Received: from shorty.local (50-1-153-216.dsl.dynamic.fusionbroadband.com [50.1.153.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 01189680119; Thu, 1 Oct 2015 05:42:33 -0400 (EDT) Original-Received: from ip6-localhost ([::1] helo=shorty) by shorty.local with esmtp (Exim 4.84) (envelope-from ) id 1ZhaNk-0001nh-Iy; Thu, 01 Oct 2015 02:42:32 -0700 In-reply-to: <560BB690.3020804@yandex.ru> 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:107138 Archived-At: Dmitry Antipov writes: > On 09/29/2015 12:28 PM, Dima Kogan wrote: > >> I found and fixed the bug, and the patch is attached. The issue was >> that the compaction code wasn't checking all the right lisp objects >> for the marks. The font entities were storing a list of fonts, and >> this list had to be traversed, looking for the marks. > > In general, this patch hits the case where the font object is marked but the > corresponding font entity is not; but is that legal? IIRC Emacs asks the font > driver to find a font described by font spec, and returned object is a font entity, > which is a list of font objects plus some extra stuff. Thus, there should be > no "free-floating" font objects, i.e. for each font object, there should be > at least one font entity object which references that font. IOW, having > marked font object without marked font entity looks like GC mark bug for me. OK. The target of the patch is as you describe: fonts marked inside an unmarked entity. I'm observing this situation every time from an emacs -Q. The font is marked inside mark_face_cache(), which looks like this: NO_INLINE /* To reduce stack depth in mark_object. */ static void mark_face_cache (struct face_cache *c) { if (c) { int i, j; for (i = 0; i < c->used; ++i) { struct face *face = FACE_FROM_ID (c->f, i); if (face) { if (face->font && !VECTOR_MARKED_P (face->font)) mark_vectorlike ((struct Lisp_Vector *) face->font); for (j = 0; j < LFACE_VECTOR_SIZE; ++j) mark_object (face->lface[j]); } } } } Clearly in this function we mark the font. We don't obviously mark the containing entity, unless it's one of the face->lface[] elements. If even in this case we're supposed to be marking the entity, where would this be?