From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu 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 10:25:18 +0800 Message-ID: <87tu7p1z75.fsf@yahoo.com> References: Reply-To: Po Lu 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="9831"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux) Cc: 56462@debbugs.gnu.org To: Daniel =?UTF-8?Q?Mart=C3=ADn?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 10 04:26:16 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 1oAMeF-0002ID-El for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 10 Jul 2022 04:26:15 +0200 Original-Received: from localhost ([::1]:51986 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAMeE-0000q3-30 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Jul 2022 22:26:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46290) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oAMe2-0000pa-3X for bug-gnu-emacs@gnu.org; Sat, 09 Jul 2022 22:26:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42195) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oAMe1-0006dS-RA for bug-gnu-emacs@gnu.org; Sat, 09 Jul 2022 22:26:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oAMe1-0006zP-LV for bug-gnu-emacs@gnu.org; Sat, 09 Jul 2022 22:26:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Po Lu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 10 Jul 2022 02:26: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.165741993626834 (code B ref 56462); Sun, 10 Jul 2022 02:26:01 +0000 Original-Received: (at 56462) by debbugs.gnu.org; 10 Jul 2022 02:25:36 +0000 Original-Received: from localhost ([127.0.0.1]:36092 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oAMdc-0006yj-62 for submit@debbugs.gnu.org; Sat, 09 Jul 2022 22:25:36 -0400 Original-Received: from sonic313-10.consmr.mail.ne1.yahoo.com ([66.163.185.33]:42424) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oAMda-0006yT-0p for 56462@debbugs.gnu.org; Sat, 09 Jul 2022 22:25:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1657419927; bh=kAReL0zYcqLi1JmWs2S59Cm9HTXsNCeoCFgg1/dmog0=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=kOYLybu5eRPEEvQWGJOp3pzQqkiHBI4nLvrJMNLACU8BN4lGxumPRiKKHljl0sQ8nWOEdI171UJcuH6etVxOBdW/tuRrLp6230lpszwZkbwy+YZMwkAfVIoG2laLJ735SZQFWnohnKxaSFgZnbaDQNLMBwzbg4NUI02RrOwhSdbSToXT0EUSpMbzTXg1LTmurxoKGOqfSzeOTnTVGKxIUdeeyJiu7YIiF9mZGNF0OjhWL5UMvrgJ+IuLXAgzPFCUzhDqByGd5hLsODXTTEDEMVZgISbZm13n6l9WxwAOChnRPg0zM5r+uEoXCU9ARNoBkI9sWE32Bc+Nzfne/dBCtQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1657419927; bh=5OiWMSruh3eX+xzw90MwdrZd4xxDGgUkrwKi6ET3kzw=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=um2Dn5zeWn37YDg79XUIl3cI6NbF++nic8SsatvSev3+f0HBQDCK0Cl7ZEizkK+cPCV6wMp9uzwt+XGUad/bhCEB08LzHekthuhId7ZrKR/EhQzTp5rpsvMOAD73aVrgspzy2zgoHzWqJy/dlO8G8LmFdq2T8gOlNwjGvAqrhyXAynt2USBGhE8053wTqVsKL8jvpNzRSc5priY6m6DA2nfl9y6br7Xn4eMfeJ4Hmwldu49NeyUJoC25FGfD7m2M+UrS2mFMX2AWAEIkGgeL373pXBPw8h5ilQXUEYAEBsvVb2DdWvm/hAcseaEkXRTvytTU1cKKYu1/PlU4TWD7eA== X-YMail-OSG: lSp0mfwVM1mYGoyIOUHIhstBI_gW4blXNNh8b_UBoaexmT9d7dIiuyZsPTkWbJI 6lq0DdHXk5Bw8yCyrk9iQwjBFyEqP0kPADfUpUesoUjo_vMbN23JW2RqDOQdbnl40phJSMdoVth6 1hZyUJWJn2yyIq05Fqc7xVKSbyBfat9zqVldzY3L2kifk9mtJHpajewN5I8SDoT6Z.SMUaDxqz5L NFj7BVAqIu57JWW4LSJqf7canAwSIHwKGsmY_sOggxcOLdaC5WP5T.ih8Y_E9PJtqdpYor8xHw12 n.pb3e7SA75Enk3peH68srWMi5duXnNhAs.LS_bWNDo51KJBiF9aTn6dolTrWQkrU91GXY9Ylsf8 lE185X5HD3eWc1YMVXYesOK0eHIUA.GsNhlPukNfqmaFdSr3.p832MDqLRkEfcvudSZ4uePgIbDp Xx1031f5UUcybkEqdj7V7uErs0Unmx5M3lzrIfSDOw1ZiKxSWynqKuTaT61UuT9_uOJpv5yKffi4 3w3AUa7dH2Vmjp3KKfVZMgwAmbosqd2XTw.1kf9cYWFubxHqoDlBtqWHqvV7fmP5B7EaEWEuO1Lm 2hKep3bUIAt8djEXQ_8Brqg1ormb4z5i_dF2HAgwTv.a9td8uDxCCUQBenoadhnc7vqVAcjEbjHh oKlFr5H9w8WsArlsxPg2F0aicO46cs4uMkxoaCBGIg1d0wjLfYVlNGFtjRSPbfaQpDb4Qenc_Dmv HLiV6PkCLMAtZD7RV_.SPvwgnV_wpe3I8xbYbpQcNkO0Ah27gcEHohBpnK2DMA.pDqx30I7fUisP 4TKtXm._NEaBzj6XOAysklMKWx9kv3KRYC0wTnYXu7 X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.ne1.yahoo.com with HTTP; Sun, 10 Jul 2022 02:25:27 +0000 Original-Received: by hermes--canary-production-sg3-67975bbd4b-hh5lh (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID c964110a468857ee6d87810df6aecd97; Sun, 10 Jul 2022 02:25:22 +0000 (UTC) In-Reply-To: ("Daniel =?UTF-8?Q?Mart=C3=ADn?="'s message of "Sat, 09 Jul 2022 16:13:39 +0200") 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:236535 Archived-At: 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?