iPhone - UIViewController class dealloc function never called

1.2k Views Asked by At

I have an issue with a project of mine.

I have a "Menu" UIViewController class and the dealloc function is never called. Most of the UI was added in Interface Builder and has no IBOutlet.

How can I free the memory if dealloc is not called?


I simulated an memory warning and now dealloc function was called.

Here is an example of my code:

//first.m
- (void) onButton
{ second *modalView = [[second alloc] init];
[self presentModalViewController:modalView animated:YES];
[modalView release];}

So, when I am in second screen and I simulate memory warning should the dealloc from the first class fire?

Anyway, in my application no dealloc is called :(.

2

There are 2 best solutions below

0
On BEST ANSWER

You can try 'Hardware -> Simulate Memory Warning' option in the Simulator to check whether the -dealloc is called.

3
On

Interface Builder caches nibs until there's a memory warning, or it exhausts its cache. At such time, it will reclaim any memory that it was using.