When I release a UIViewController, the UIViewController is correctly destroyed but its dealloc method is not called.
If the UIViewController has been destroyed (it is nil in the console), then the retain count should be 0, consequently I expect the -(void)dealloc method to be called.
I’ve also checked for subclasses of my UIViewController, overriding dealloc without calling the superclass method, but this is not the case.
This is how I initialize it:
myViewController = [[MyViewController alloc] initWithViewController:statusPicker];
What could be the reason ?
Thanks
Well, no. The fact of being
nil, doesn’t mean theUIViewControllerhas been released. Put it simple, the pointer for theUIViewController, is now pointing tonil, but the memory where theUIViewControllerreside is still being occupied. Instead of being calleddealloc, two things might be happening:1) There is something else with a reference to the
UIViewController(example: when youpushViewControllerB from A, A got a reference to B).2) You got a memory leak.
Again I am basing my answer in what you said: