2010-08-17 10:30:36.019 TAU 4[50133:207] coleccionVista retain count0: 0
2010-08-17 10:30:36.021 TAU 4[50133:207] coleccionVista retain count1: 1
2010-08-17 10:30:36.022 TAU 4[50133:207] coleccionVista retain count2: 3
2010-08-17 10:30:36.022 TAU 4[50133:207] coleccionVista retain count3: 2
2010-08-17 10:30:36.088 TAU 4[50133:207] coleccionViewController->viewWillAppear
2010-08-17 10:30:38.515 TAU 4[50133:207] coleccionViewController->viewWillDisappear
Second time:
Code:
2010-08-17 10:30:44.171 TAU 4[50133:207] coleccionVista retain count0: 1
2010-08-17 10:30:44.173 TAU 4[50133:207] coleccionVista retain count1: 1
2010-08-17 10:30:44.174 TAU 4[50133:207] coleccionVista retain count2: 3
2010-08-17 10:30:44.176 TAU 4[50133:207] coleccionVista retain count3: 2
2010-08-17 10:30:44.241 TAU 4[50133:207] coleccionViewController->viewWillAppear
2010-08-17 10:30:52.332 TAU 4[50133:207] coleccionViewController->viewWillDisappear
I also have a NSLog message on the dealloc method that isn't showing. But I've noticed that if I force another [coleccionVista release] after the other one the dealloc message is showed but crashing when trying to [super dealloc]. I'm not holding any other reference of coleccionViewController (I've been searching in the code and all the uses of the method are in the code I'm showing to you).
Dealloc gets called when the class gets released. So this may not be happening because it is retained or the os doesn't need to release it.
This is normal. Leave the breakpoint in there and at some point it will get called.
As long as the dealloc method is releasing all the objects you need to release, then don't worry about it.
The problem is that if I load the program into the device, after using the app some time, it gets a memory warning and crashes without deallocating. So it must be some other mistake. But thanks for your quick answer.
The problem is that if I load the program into the device, after using the app some time, it gets a memory warning and crashes without deallocating. So it must be some other mistake. But thanks for your quick answer.
Ok that's slightly different. So in the memory warning delegate methods you want to try and release things like your xibs, any large images etc. Basically anything that can be recreated easily.
Ok that's slightly different. So in the memory warning delegate methods you want to try and release things like your xibs, any large images etc. Basically anything that can be recreated easily.
Yes, I know. But that's not the point. the viewController never gets deallocated and is the reason of the memory warning. Thanks anyway .Any other ideas?
Yes, I know. But that's not the point. the viewController never gets deallocated and is the reason of the memory warning. Thanks anyway .Any other ideas?
So I don't think I explained myself very well. Maybe Apple can do a better job:
Quote:
When a view controller receives a memory warning (didReceiveMemoryWarning), it should relinquish ownership of resources that are currently not needed and that can be recreated later if required. One such resource is the view controller's view itself. If it does not have a superview, the view is disposed of (in its implementation of didReceiveMemoryWarning, UIViewController invokes [self setView:nil]).
So are you releasing and nilling the viewController itself? If not it will never get a dealloc.
So I don't think I explained myself very well. Maybe Apple can do a better job:
So are you releasing and nilling the viewController itself? If not it will never get a dealloc.
Hope this helps. M.
Your explanation was very clear. I understood you perfectly. And I release all the stuff that isn't necessary in the didReceiveMemoryWarnin. But I get the memory warning because it never gets deallocated, so each time I push again the viewController the program gets more and more used memory. After that viewController I push more views into the stack and when I pop one (pushing the back button), it gets deallocated as expected, but not with this one.
Finnally I think I figured out what happened. I've changed a lot of code, so I'm not sure about it, but it seems that it was a NSTimer that was using a method of the class coleccionVista, so it was maintaining a reference of the class so it was impossible to deallocate it.