I dont know why this is giving memory leak in xcode 4.2. Since I didn't alloc eventArraySave do I need to release it? I thought this will be added to the autorelease pool.
//Unarchive in to array
NSMutableArray *eventArraySave = [NSKeyedUnarchiver unarchiveObjectWithFile:savedfilePathName];
Do I need to release it or is there anything wrong in the above code. Also want to stress that I haven't alloced eventArraySave or inited eventArraySave. Thanks in advance :)
You should not release eventArraySave. It will be returned to you with a net retain count of 0 (after autorelease). If you're seeing leaks from this line, then that suggests that you are over-retaining it somewhere else, or possibly that you are over-retaining some object that is contained within eventArraySave (since this is where that object is allocated as well).
The leak tools do not tell you where your mistake is. They tell you where you allocated the memory that was later leaked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With