Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xamarin.iOS/monotouch内存管理_Xamarin.ios_Xamarin - Fatal编程技术网

Xamarin.iOS/monotouch内存管理

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

我试图理解Xamarin.iOS中需要的内存管理

在以下场景中,this.NavigationController.PopToRootViewController是否释放创建的UIViewController或 我应该释放他们吗?如果我需要这样做,应该在哪里做

每个字母代表一个UIViewController)

A(rootViewcontroller)

从A:

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()处理事物和空引用,我才能取得任何进展,但这种策略很容易引入错误。