views:

72

answers:

2

Hi,

I m Copying my code here below :-

-(IBAction)referencewindow:(id)sender
{
    frmReferences *reference = [[frmReferences alloc]initWithNibName:@"frmReferences" bundle:nil];
    [self presentModalViewController:reference animated:YES];
}

There are number of places I m using presentModelViewController and my problem is that stack shows memory leakage due to presentmodelviewcontroller.

when we use presentModelViewController to call other nib as above stated then it just override to the previous view but previous view is still in process thats why memory lekage problem is occuring so please tell me when i call other nib file using presentModelViewController then how to unload that previous view from memory while switch to other view and then on other view to next view.

A: 

Your building a navigation hierarchy using present modal view? It could work but you need to released it sometime.

I think if you tried using normal memory management rules it would work out. Try going back from your views and they should be released, you'd see the memory go down in instruments.

JoePasq
You should read the question before you submit something that shows you obviously don't have a clue what was asked...
David Nelson
+1  A: 

Hi, You must release your viewController after call the presentModalViewController method like here:

- (IBAction)referencewindow:(id)sender {
   frmReferences *reference = [[frmReferences alloc]initWithNibName:@"frmReferences" bundle:nil];
   [self presentModalViewController:reference animated:YES];
   [reference release];
}

There is more information here: Modal View Controllers

Yannick L.