Xamarin.iOS/monotouch内存管理
我试图理解Xamarin.iOS中需要的内存管理 在以下场景中,this.NavigationController.PopToRootViewController是否释放创建的UIViewController或 我应该释放他们吗?如果我需要这样做,应该在哪里做 每个字母代表一个UIViewController) A(rootViewcontroller) 从A:Xamarin.iOS/monotouch内存管理,xamarin.ios,xamarin,Xamarin.ios,Xamarin,我试图理解Xamarin.iOS中需要的内存管理 在以下场景中,this.NavigationController.PopToRootViewController是否释放创建的UIViewController或 我应该释放他们吗?如果我需要这样做,应该在哪里做 每个字母代表一个UIViewController) A(rootViewcontroller) 从A: B b = new B() this.NavigationController.PushViewController (b, true
B b = new B()
this.NavigationController.PushViewController (b, true);
从B:
C c = new C()
this.NavigationController.PushViewController (c, true);
从C:
D d = new D()
this.NavigationController.PushViewController (d, true);
从D:
this.NavigationController.PopToRootViewController(true);
能否启用“使用引用计数扩展”?这会帮你解决的
谢谢,我正在尝试此配置。不过,就目前而言,我在XCode Instruments分配中看到的结果有点奇怪,因为我没有看到任何内存被释放,即使我正在显式地处理某些对象,并且在以前的配置中看到这些对象被释放。我必须提到的是,我远不是使用XCode工具分配的专家。根据我的经验,在使用Xamarin时避免内存泄漏非常困难。我们的应用程序有一个代码路径,可以从零开始或多或少地重新启动应用程序,重建所有对象并忘记旧对象。但是那些旧的还在记忆中,我花了一百个小时试图摆脱它们。只有通过Dispose()处理事物和空引用,我才能取得任何进展,但这种策略很容易引入错误。