GNU bug report logs -
#56462
29.0.50; [PATCH] Memory leak in ns_draw_relief
Previous Next
Reported by: Daniel Martín <mardani29 <at> yahoo.es>
Date: Sat, 9 Jul 2022 14:14:01 UTC
Severity: normal
Tags: patch
Found in version 29.0.50
Fixed in version 29.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 56462 in the body.
You can then email your comments to 56462 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56462
; Package
emacs
.
(Sat, 09 Jul 2022 14:14:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Daniel Martín <mardani29 <at> yahoo.es>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sat, 09 Jul 2022 14:14:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
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.
[0001-Fix-memory-leak-in-ns_draw_relief.patch (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56462
; Package
emacs
.
(Sun, 10 Jul 2022 02:26:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 56462 <at> debbugs.gnu.org (full text, mbox):
Daniel Martín <mardani29 <at> 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?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56462
; Package
emacs
.
(Sun, 10 Jul 2022 10:38:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 56462 <at> debbugs.gnu.org (full text, mbox):
Po Lu <luangruo <at> yahoo.com> writes:
> Daniel Martín <mardani29 <at> 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?
Thanks, I can give it a try.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56462
; Package
emacs
.
(Sun, 10 Jul 2022 20:53:02 GMT)
Full text and
rfc822 format available.
Message #14 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Daniel Martín via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs <at> gnu.org> writes:
>>
>> 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.
Here's a patch where the static variables are now proper fields in the
ns_output structure. Is that what you had in mind?
[0001-Fix-memory-leak-in-ns_draw_relief.patch (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56462
; Package
emacs
.
(Sun, 10 Jul 2022 20:53:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56462
; Package
emacs
.
(Mon, 11 Jul 2022 01:51:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 56462 <at> debbugs.gnu.org (full text, mbox):
Daniel Martín <mardani29 <at> yahoo.es> writes:
> Daniel Martín via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs <at> gnu.org> writes:
>
>>>
>>> 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.
>
> Here's a patch where the static variables are now proper fields in the
> ns_output structure. Is that what you had in mind?
Yes, this would be great. Thanks.
Alan might have some comments; if he doesn't, I'll install this now.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56462
; Package
emacs
.
(Mon, 11 Jul 2022 08:02:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 56462 <at> debbugs.gnu.org (full text, mbox):
On Mon, Jul 11, 2022 at 09:50:11AM +0800, Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors wrote:
> Daniel Martín <mardani29 <at> yahoo.es> writes:
>
> > Daniel Martín via "Bug reports for GNU Emacs, the Swiss army knife of
> > text editors" <bug-gnu-emacs <at> gnu.org> writes:
> >
> >>>
> >>> 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.
> >
> > Here's a patch where the static variables are now proper fields in the
> > ns_output structure. Is that what you had in mind?
>
> Yes, this would be great. Thanks.
>
> Alan might have some comments; if he doesn't, I'll install this now.
No, looks fine to me.
--
Alan Third
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56462
; Package
emacs
.
(Mon, 11 Jul 2022 10:26:01 GMT)
Full text and
rfc822 format available.
Message #26 received at 56462 <at> debbugs.gnu.org (full text, mbox):
Daniel Martín <mardani29 <at> yahoo.es> writes:
> Daniel Martín via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs <at> gnu.org> writes:
>
>>>
>>> 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.
>
> Here's a patch where the static variables are now proper fields in the
> ns_output structure. Is that what you had in mind?
Now installed, so I'm closing this bug.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56462
; Package
emacs
.
(Mon, 05 Sep 2022 19:24:01 GMT)
Full text and
rfc822 format available.
Message #29 received at 56462 <at> debbugs.gnu.org (full text, mbox):
Po Lu <luangruo <at> yahoo.com> writes:
> Now installed, so I'm closing this bug.
The bug report was still open, so I'm closing it now.
bug marked as fixed in version 29.1, send any further explanations to
56462 <at> debbugs.gnu.org and Daniel Martín <mardani29 <at> yahoo.es>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Mon, 05 Sep 2022 19:24:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 04 Oct 2022 11:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 205 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.