Where is the memory leak in my UITableViewController?

后端 未结 5 646
逝去的感伤
逝去的感伤 2021-01-27 18:00

The table view works fine however when I leave the view and come back to it the second time, I get a memory leak. Probably something in the viewDidLoad just not sure.

I

5条回答
  •  余生分开走
    2021-01-27 18:38

    I see most of your statement are ready for leak, e.g in the viewDidUnload method , you are not releasing any instance member properly.

    you need to call release on the object which you either alloced, init or retain.

     (void)viewDidUnload {
        // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.
        // For example: self.myOutlet = nil;
    
        [remoteRecipientItems release];
        remoteRecipientItems = nil;
        [remoteRecipientID release];
        remoteRecipientID = nil;
         ..................
        ..................
    
    }
    

    Would suggest you to spend some time to read Memory Management Programming Guide

提交回复
热议问题