Page 1 of 1
Bug: Memory leak in 1.1.x Framework
Posted: Fri Oct 12, 2007 4:55 pm
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.
Posted: Fri Oct 12, 2007 6:22 pm
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.
Posted: Sat Oct 13, 2007 10:16 am
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.
Posted: Tue Oct 16, 2007 11:34 am
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.
Posted: Wed Oct 17, 2007 2:07 pm
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]