Question

I'm presenting a modalViewController. After I dismiss the modal view controller with:

- (void)dismissModalViewControllerAnimated:(BOOL)animated

.. the view is still in memory. How do I dismiss it such that it will use memory?

Thanks.

Was it helpful?

Solution

When you present your modal view controller, you need to release it.

OTHER TIPS

I'm having the same problem. I'm only temporarily retaining the ViewController until I call presentModalViewController, then release the alloc. But after dismissModalViewControllerAnimated, I never get the ViewController's dealloc.

If I add a self-release from the ViewController, then I get this after control returns to the event loop:

Program received signal: “EXC_BAD_ACCESS”. objc_msgSend

Having the same problem. I have a NavigationController that I present modally, and as rootController of this NavigationController I have simple ViewController object. The rare situation is, when I run my app against Instruments using Allocations and after dismissing the modalController, in this case the NavigationController, the NavigationController goes away but the rootController remains in memory and memory grows and grows. (note: Leak in Instruments does not show any leak and the app was running on the device not the simulator).

when you are presenting a modal view controller you will be definitely allocating so there is rule whenever you allocate you need to release it also so please release the view controller which you are presenting in the modalviewcontroller.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top