Bug 23200 - UIViewControllers not being disposed of on device, simulator works
Summary: UIViewControllers not being disposed of on device, simulator works
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: XI 8.0.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2014-09-19 15:20 UTC by Will Smith
Modified: 2014-09-19 16:41 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Will Smith 2014-09-19 15:20:22 UTC
I've just recently upgraded an application to iOS 8 and when I run it on a device, I noticed that all my print calls that happen when a UIViewController gets disposed of never gets called. But, they get called on the simulator, but not on device. I checked to see what is going on with the memory usage on the device; I noticed my memory keeps increasing at a serious rate that is not feasible for any application.

The easiest way to reproduce is to create a new C# iPhone Master-Detail project. DetailViewController will not get disposed of on the device, but will on the simulator.

I remember this not happening on previous versions of Xamarin.iOS, and UIViewControllers used to be disposed of on devices. Since the upgrade, they are not. On my real non-trivial application, a few navigations back forth on a few screens, 50mb of memory will be leaked; not good.

Am I doing something wrong? Am I missing something here? I've searched online head to toe and learning as much as I can on how memory management works for iOS. I understand what I need to do, but UIViewControllers are supposed to be disposed of automatically if it can as long as no one else is referencing it.
Comment 1 Will Smith 2014-09-19 16:27:28 UTC
Doing some testing on this:
Calling GC.Collect(2) will dispose of the DetailViewController in the Master-Detail project.
Or if I get to a certain allocation point, it will start disposing over the viewcontrollers.

On my non-trivial app, I don't see this. I'll just to get more info.
Comment 2 Will Smith 2014-09-19 16:41:54 UTC
I think this is invalid. More testing proves I'm doing something incorrect.