Bug: Memory leak in 1.1.x Framework

The Growl forums have moved to Google Groups, this forum is read only.
Locked
brianb
Harmless
Posts: 7
Joined: Fri Oct 12, 2007 2:09 pm

Bug: Memory leak in 1.1.x Framework

Post by brianb »

There's a mem leak in the Growl 1.1.x Framwork. Every time a notification is sent, several bytes are leaked (in my case 64). Using Malloc Debug, I tracked it down to + (NSDictionary *) [GrowlApplicationBridge registrationDictionaryByFillingInDictionary:(NSDictionary *)regDict restrictToKeys:(NSSet *)keys ]

That method forgets to release mRegDict before returning. 0.7.6 does not leak and looking at the code it was because the dict was released:

>>> 1.1.1
return mRegDict;
<<<< 0.7.6
NSDictionary *result = [NSDictionary dictionaryWithDictionary:mRegDict];
[mRegDict release];
return result;
>>>

I confirmed this by using the 0.7.6 framework in my app and and then running it under Malloc Debug - no more leaks.
User avatar
evands
Cocoaforge Admin
Posts: 3152
Joined: Thu Dec 02, 2004 10:55 pm
Location: Decatur, GA
Contact:

Post by evands »

Thanks for finding the leak and even more for determining how to fix it! I've followed your advice and made + (NSDictionary *) registrationDictionaryByFillingInDictionary:(NSDictionary *)regDict restrictToKeys:(NSSet *)keys return an autoreleased dictionary instead of a retained one as it was doing; this fix will be in the next release of Growl.
The duck still burns.
--
My company: Saltatory Software. Check it out :)
User avatar
bgannin
Growl Team
Posts: 1817
Joined: Thu Dec 02, 2004 8:11 am
Location: ..here
Contact:

Post by bgannin »

evands wrote:Thanks for finding the leak and even more for determining how to fix it! I've followed your advice and made + (NSDictionary *) registrationDictionaryByFillingInDictionary:(NSDictionary *)regDict restrictToKeys:(NSSet *)keys return an autoreleased dictionary instead of a retained one as it was doing; this fix will be in the next release of Growl.
What revision was this committed in? I don't see it in the history at a cursory glance.
Try my software!

#define ADIUMX pimp //by me
#define QUESTION ((2b) || (!2b))
Have you hugged a programmer today?
brianb
Harmless
Posts: 7
Joined: Fri Oct 12, 2007 2:09 pm

Post by brianb »

Thanks evands. I don't see a track ticket yet though. Just want to make sure it gets addressed for 1.1.2.
User avatar
evands
Cocoaforge Admin
Posts: 3152
Joined: Thu Dec 02, 2004 10:55 pm
Location: Decatur, GA
Contact:

Post by evands »

bgannin wrote:
evands wrote:Thanks for finding the leak and even more for determining how to fix it! I've followed your advice and made + (NSDictionary *) registrationDictionaryByFillingInDictionary:(NSDictionary *)regDict restrictToKeys:(NSSet *)keys return an autoreleased dictionary instead of a retained one as it was doing; this fix will be in the next release of Growl.
What revision was this committed in? I don't see it in the history at a cursory glance.
Oops. I told it to commit, but apparently it failed and I didn't notice; I had a tmp file with the message.

[4691]
The duck still burns.
--
My company: Saltatory Software. Check it out :)
Locked