Search code examples
iphonememory-leaksuinavigationcontrollerpushviewcontroller

Leaks in navigationcontroler when puching it


i have found leaks in the below code at particular area, means when i push my view from other sides, There is not any leak i found but only this push give me 100%leak.

actionsListing *View = [[actionsListing alloc] init];
[self.navigationController pushViewController:View animated:YES];
[View release];

What will i do thanks.


Solution

  • That code is fine - you're doing everything correctly.

    Are you testing in the simulator or on a device? If it's the simualtor, don't. The simulator has a different memory model and reports leaks that aren't really there; always test for leaks on a device :)

    If you still get leaks, you're retaining the view controller somewhere else by mistake - that code is definitely correct.