From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel =?UTF-8?Q?Mart=C3=ADn?= via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#56462: 29.0.50; [PATCH] Memory leak in ns_draw_relief Date: Sun, 10 Jul 2022 12:37:48 +0200 Message-ID: References: <87tu7p1z75.fsf@yahoo.com> Reply-To: Daniel =?UTF-8?Q?Mart=C3=ADn?= Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7740"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (darwin) Cc: 56462@debbugs.gnu.org To: Po Lu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 10 12:38:23 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oAUKV-0001rA-L4 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 10 Jul 2022 12:38:23 +0200 Original-Received: from localhost ([::1]:40288 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAUKU-0001nI-Fk for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 10 Jul 2022 06:38:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54010) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oAUKB-0001nA-3I for bug-gnu-emacs@gnu.org; Sun, 10 Jul 2022 06:38:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42389) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oAUK9-0007zk-S1 for bug-gnu-emacs@gnu.org; Sun, 10 Jul 2022 06:38:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oAUK9-0005fg-OM for bug-gnu-emacs@gnu.org; Sun, 10 Jul 2022 06:38:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Daniel =?UTF-8?Q?Mart=C3=ADn?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 10 Jul 2022 10:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56462 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 56462-submit@debbugs.gnu.org id=B56462.165744947721790 (code B ref 56462); Sun, 10 Jul 2022 10:38:01 +0000 Original-Received: (at 56462) by debbugs.gnu.org; 10 Jul 2022 10:37:57 +0000 Original-Received: from localhost ([127.0.0.1]:36286 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oAUK5-0005fO-04 for submit@debbugs.gnu.org; Sun, 10 Jul 2022 06:37:57 -0400 Original-Received: from sonic310-57.consmr.mail.ir2.yahoo.com ([77.238.177.30]:40108) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oAUK3-0005fB-Qg for 56462@debbugs.gnu.org; Sun, 10 Jul 2022 06:37:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048; t=1657449470; bh=OADT1D2xOaRBGHZ43UiFGSTI4aJOJmvZB5IcdWPY+qQ=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=gH4Ll3D9w3JvgKFWttJh1WCUoBoJK0eyy5bgTMhktNdmRrseEVj8wrndRx/86OixNxx9pRwvIwm2g8ea/YCYJvJnHKnfeXI/swZjZLztPspUlbWGvXAbImDLt2oQuitKvdHQu+0e5PsrG0VudfG6ZvX4dzFsYG+YAezYtFRp4ybhyZj6iw8V16yJSHvt2onI3p7wl09/FWD+a2LH8WtAFopDchpb4U1r6SvDRf7ozyORKINWiUfF5pKmLambBY4IM4h44zaPf8O52zwcktqmxJLm1CDWwhpwbGOBGaapYd2gn9zdHo2eDUY+rW0ZNICFEPpliNR97iTbS843xadUew== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1657449470; bh=E8POWTufu1fm/y69VReUxH+taaTbIDSlMxd3Ryme/sX=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=dnpbO5sDbD7kGsww0uX42MpUfUiZtOe51jQCN8O7eeWuLu2Y+nK4UP/wYkPzhDGdac4rawLVm2+WKISvZR5mftqsAojtEe2xsg5p36/BUzPJs9DHFIEncG+vl6DmU48C7s6715KwHmTDTUX0XPTgSKy5p4Kok/l2ltVQypgZOjvltxd9n5TjaLPMoqJGwEneWIPQnVtSKboNd6E0/KiWFf4nHGZ43wMGLjyQMN8f/9e6iDXvMVCVZ92JOFv0gPzwUgarjxlk4/mGvbMYcMyK/hwy778EkBawwqftvfAhQpMydihlH23ml5IG1Z9405EA35YZLSQGTq3BU6uBP4DG8Q== X-YMail-OSG: sKNln4MVM1mzxLG1HmNW9zl5s9wdntFLvn4PyOFu6X5w1NkijbAIs7JP798Hzzb SMTXjvnI6m7E2tW_E_p.CS5nuVThzptB3_7KWkCGNf24qDb_aV_P57PlPBPaEBCFhILs_eb0QaEo cW7Oeygx_UROFBZxhMf2ZBdlhwlGizz_RRpj9L2ADK59.JlIKg7Npuy_Fwx_oxl.71RQ1gZsn696 RpERH4FyfjX73tES4nuUT2PjBoOiIt2uhlywkxc6WJ75AyvTWMx0tqTzNOlPDhlEkwFlL7ilfPNd haCyHkYdCNKmJPS7yi1cwLXrOJjVQCvxW.LZ_WTET2UfFyPhWlg6PRSlaIvEVurNbA1VGVGRB_GA qSw0GCjVC6_J_Yv.AgTELvV3oVzwsYPjLgToIQkG7zjF0rAEcwnyN14VPKEbgxEJPRq5HICs_D6W 7lpZeOq4HruuqzLzhtqR_EMVOL2wvvjacwJJUvFsNSlnE.Xfc2EydjuNj20d2Jcf3HhddtrBAJmc D75w.nyHjLb1EN62PXtD_CcBBOBO8GpGAtVO8JBK9mlkRgqbqWZS.euCOALNLmJChdiqk_z0TyEi wVX1ahySjyewyTQKYAmBZftD8Ia9G81hzrv3.HkU3aVkJ2x7TTi24tgN99vXPVoU4aOM8hw5mv86 yXZtqGfeNtpEbBs3vvltfu1Z9kxWi.9X9twUJxiSvz4JeuUaJWMXUOpIVNdAUgNyDOzPPrQ_B_v0 6kQTBXExQuq0xosmawxyjGLmbQ1N.lrHojEfIpkHZR3uFN7OtJ5qdKumHZb99cGbJRiRxYjsURus 1RUeSG3GLcdR2jU3Ah_HMJeVKltaVrOkb_fawsJFKn X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic310.consmr.mail.ir2.yahoo.com with HTTP; Sun, 10 Jul 2022 10:37:50 +0000 Original-Received: by hermes--canary-production-ir2-74b4d6d794-wvl67 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 73c95a8de31e559cff528b513f57479c; Sun, 10 Jul 2022 10:37:49 +0000 (UTC) In-Reply-To: <87tu7p1z75.fsf@yahoo.com> (Po Lu's message of "Sun, 10 Jul 2022 10:25:18 +0800") X-Mailer: WebService/1.1.20381 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:236552 Archived-At: Po Lu writes: > Daniel Mart=C3=ADn writes: > >> I ran the Leaks tool with Emacs 29, and I've found a memory leak in the >> NS version of Emacs. >> >> Since commit c7b48b61d08f0b6a08584080badc60fe62ba1db1, in function >> ns_draw_relief, static local variables baseCol and lightCol are assigned >> to nil separately to their declaration. That has the subtle consequence >> that the further down calls to [baseCol release] and [lightCol release] >> become a no-op, so each time ns_draw_relief is called it leaks some >> instances of NSColor. >> >> The fix is to revert to the previous way those static variables were >> declared. >> >> I've attached a patch with the correction. With this fix, the leaks >> tool doesn't report the NSColor leaks anymore when I play around with >> Emacs 29. > > Thanks. But I think the use of static variables there is rather ugly, > and it would be much nicer if we replicated the `x_setup_relief_color' > logic there. > > Do you want to work on that, or should I? Thanks, I can give it a try.