Quote:
Originally Posted by _mubashir
I have put NSLog in dealloc and it gets called fine. Yes I am releasing arrProvider (NSMutableArray) in the appdelegate's dealloc. I am getting leak on Provider object as well so I assume its leaking. One thing I need to know is I have arrProvider filled with Provider objects, now do I need to release all Provider objects before releasing arrProvider or I can just release it ?
|
When the array gets deallocated, every object in the array gets a release message. This means that if you followed the rules so that (1) the array has a retainCount of one and (2) every object in the array has a retaincount of one, calling [array release] will deallocate both the array and every object inside. You should not need to remove them from the array or call release on them before releasing the array.
If you're getting a leak on a Provider object, hunt that down first - if you leak a Provider, every object in that provider may get leaked even if you followed the rules inside the Provider class.
Quote:
|
YES its shows malloc, release, malloc and then autorelease. autorelease is not cleaning anything so its becomes a leak.
|
Hunt down the Provider leak first. "malloc, release, malloc, autorelease" is the history of two different objects. The first object's history was "malloc, release" - it was released properly and destroyed. Then the address was reused for a second object, which as you said is getting leaked. I would expect "autorelease" to be followed by "release" when the autorelease pool clears; not sure why it isn't.
You will be an expert in the leaks tool by the time you are done.
Quote:
I also need to know the View that we push in the navigation controller - do we need to release it too?
I am autoreleasing it like this
Code:
Providers *ProviderView = [[[Providers alloc] CustomInitWithNibName:@"Providers" bundle:nil bIsProvider:YES] autorelease];
[self.navigationController pushViewController:ProviderView animated:YES];
|
Not sure, someone else will have to answer - I haven't done navigationControllers for a while.