Andrei Neacsu
Andrei Neacsu

Reputation: 1473

iPhone - UIViewController class dealloc function never called

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 :(.

Upvotes: 0

Views: 1209

Answers (2)

Kenny K.
Kenny K.

Reputation: 36

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

Upvotes: 1

jer
jer

Reputation: 20236

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.

Upvotes: 0

Related Questions