From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dima Kogan Newsgroups: gmane.emacs.devel Subject: Re: Debugging emacs memory management Date: Mon, 05 Oct 2015 02:49:11 -0700 Message-ID: <87bncd1w88.fsf@secretsauce.net> References: <87zj8l3r32.fsf@secretsauce.net> <87vbbbxz2e.fsf@secretsauce.net> <55F998C8.4080203@cs.ucla.edu> <87vbb492ea.fsf@secretsauce.net> <83twqonub8.fsf@gnu.org> <87oagw885o.fsf@secretsauce.net> <837fnknlbm.fsf@gnu.org> <834mionkdg.fsf@gnu.org> <87fv1p232b.fsf@secretsauce.net> <83wpv1zr4q.fsf@gnu.org> <87egh9205z.fsf@secretsauce.net> <83r3l9zowx.fsf@gnu.org> <87d1wt1xe0.fsf@secretsauce.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1444038621 17653 80.91.229.3 (5 Oct 2015 09:50:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 5 Oct 2015 09:50:21 +0000 (UTC) Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 05 11:50:07 2015 Return-path: Envelope-to: ged-emacs-devel@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 1Zj2PE-0002bU-7g for ged-emacs-devel@m.gmane.org; Mon, 05 Oct 2015 11:50:04 +0200 Original-Received: from localhost ([::1]:45078 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zj2PC-0003iY-MK for ged-emacs-devel@m.gmane.org; Mon, 05 Oct 2015 05:50:02 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55392) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zj2OT-0003fb-D0 for emacs-devel@gnu.org; Mon, 05 Oct 2015 05:49:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zj2OQ-0000Wj-6a for emacs-devel@gnu.org; Mon, 05 Oct 2015 05:49:17 -0400 Original-Received: from out4-smtp.messagingengine.com ([66.111.4.28]:56548) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zj2OP-0000Vi-Sy for emacs-devel@gnu.org; Mon, 05 Oct 2015 05:49:14 -0400 Original-Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 5282720876 for ; Mon, 5 Oct 2015 05:49:13 -0400 (EDT) Original-Received: from frontend1 ([10.202.2.160]) by compute3.internal (MEProxy); Mon, 05 Oct 2015 05:49:13 -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=0pUgj hcEG63VVOGXTGGJoR5ToCQ=; b=QzcLKuZ31j3kJ7M4Qm47U7k5XhumFEmtOFP4p yXPGJbYnmkM6wyMAoKBHnEwmhZrQaZQU88naeKhBl7IncIYRBPTHmjzomizlNYZR xBfR0nFRw/c1eCRccFEvg3JBvvYqRccG6BBqulz5FLRc7JXMioTx/eWkquVgLQCy 1kY5Jc= 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=0pUgjhcEG63VVOGXTGGJoR5ToCQ=; b=TIHp1 K71np8MN4tfeTm7USep8rzDg1mNwaHsdTKeyUcaC/WqodqueeDeTkFqjDr7jvIIp kLRHad0ww1VjJpW8BIW9LiQwWpugLTvN2t2/xrDrwdgEqciwJ/CEn8bLSMCRUn3R w8UJoFACo1F8IgNSrbU9sRM6cNayhjsnCSX754= X-Sasl-enc: e99xLOIBZNiRLY6RcAmClX7dlmXk5yR0sALPdoLlfeaM 1444038552 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 F1FE7C00023; Mon, 5 Oct 2015 05:49:12 -0400 (EDT) Original-Received: from localhost ([::1] helo=shorty) by shorty.local with esmtp (Exim 4.84) (envelope-from ) id 1Zj2ON-0000WJ-QW; Mon, 05 Oct 2015 02:49:11 -0700 In-reply-to: <87d1wt1xe0.fsf@secretsauce.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.28 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:190931 Archived-At: Dima Kogan writes: > Making copy_font_spec() a deep copy probably would resolve this. > Trying that now. Aaand, that works. The leak went down from 24KB/frame to 12KB/frame. Patch below. I'm not as familiar with lisp as I should probably be, so there's probably a nicer way for this patch to have been written. diff --git a/src/font.c b/src/font.c index 8e06532..ca872d0 100644 --- a/src/font.c +++ b/src/font.c @@ -3981,7 +3981,15 @@ copy_font_spec (Lisp_Object font) pcdr = spec->props + FONT_EXTRA_INDEX; for (tail = AREF (font, FONT_EXTRA_INDEX); CONSP (tail); tail = XCDR (tail)) if (!EQ (XCAR (XCAR (tail)), QCfont_entity)) - *pcdr = Fcons (XCAR (tail), Qnil), pcdr = xcdr_addr (*pcdr); + { + if (CONSP (XCAR (tail))) + *pcdr = Fcons (Fcons( XCAR (XCAR (tail)), + XCDR (XCAR (tail))), + Qnil); + else + *pcdr = Fcons (XCAR (tail), Qnil); + pcdr = xcdr_addr (*pcdr); + } XSETFONT (new_spec, spec); return new_spec;