Open kgn opened 13 years ago
Glad I read this issue before adding this to my project. Personally I would prefer just to remove the "self." and do a direct assignment because all of these seem to be in the init functions anyway (pointers should be nil at this point). When using "self." the setter is used, which retains the object, and you're passing an autoreleased object. If you assign it directly you avoid using an autorelease and the retainCount is balanced in the dealloc regardless of whether the property is "retain" or "assign". If for some reason later the property was changed to "assign" you won't loose the object by doing a direct assignment (because object ins alloc'ed in init, and released in dealloc).
I found some leaks and fixed them. I attached the patch.
From and email: I’ve found that Instruments/leak detection is finding a number of leaks, even when using sample app. I’m hoping it is something I am doing incorrectly here. For example, when I init default values from my app delegate, leaks are reported in the in the InAppSetttingsRegisterDefaults loadFile function. There are 12 leaks reported. It appears that the retain count of ‘setting’ is 2 immediately before its release. I’d appreciate any suggestions you may have.
I had posted this original message back on June 2 and was wondering if you would have an updated version of the code soon with the memory leaks fixed?
Thanks
I haven't been writing iOS apps recently so I haven't looked into this issue.
I'll need to look into this, hopefully it's fixed with ARC
First, a big thanks for this code!! After running my app through Instruments, I found a few leaks. Below is the info I extracted from Instruments. Let me know if you need anything else. LEAKED OBJECT: Malloc 16 bytes EVENT TYPE: Malloc RESPONSIBLE CALLER: [InAppSettingsReaderRegisterDefaults loadFile]