unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: "Daniel Martín" <mardani29@yahoo.es>
Cc: 56462@debbugs.gnu.org
Subject: bug#56462: 29.0.50; [PATCH] Memory leak in ns_draw_relief
Date: Sun, 10 Jul 2022 10:25:18 +0800	[thread overview]
Message-ID: <87tu7p1z75.fsf@yahoo.com> (raw)
In-Reply-To: <m1fsjaz84s.fsf@yahoo.es> ("Daniel Martín"'s message of "Sat, 09 Jul 2022 16:13:39 +0200")

Daniel Martín <mardani29@yahoo.es> 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?





  reply	other threads:[~2022-07-10  2:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <m1fsjaz84s.fsf.ref@yahoo.es>
2022-07-09 14:13 ` bug#56462: 29.0.50; [PATCH] Memory leak in ns_draw_relief Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-10  2:25   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-07-10 10:37     ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-10 20:52       ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-11  1:50         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-11  8:01           ` Alan Third
2022-07-11 10:25         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-05 19:23           ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tu7p1z75.fsf@yahoo.com \
    --to=bug-gnu-emacs@gnu.org \
    --cc=56462@debbugs.gnu.org \
    --cc=luangruo@yahoo.com \
    --cc=mardani29@yahoo.es \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).