简体   繁体   English

Xamarin表单导航不释放内存

[英]Xamarin forms Navigation not releasing Memory

I'm new to Xamarin.Forms using Xamarin.forms(version 2.0.0) and I get stuck in an Issue where my Application is getting Crash again and again due to memory leak. 我是使用Xamarin.forms(版本2.0.0)的Xamarin.Forms的新手,我陷入了一个问题,我的应用程序因内存泄漏而一次又一次地崩溃。 I suspect that is because When navigating a page off of a navigation stack, the memory for the view is not released. 我怀疑这是因为当从导航堆栈导航页面时,视图的内存不会被释放。 Even I user Dispose() Method to release the unused references. 甚至我用户Dispose()方法来释放未使用的引用。 But still having this bug. 但仍然有这个bug。 Heap space is growing every time I revisit. 每次重访时,堆积空间都在增长。 Below are the sample code how I'm performing navigation stack (push/pop). 下面是我如何执行导航堆栈(推/弹)的示例代码。

    Navigation.PushModalAsync (new NewPage ());
    Navigation.PopAsync ());

Is there any solution for this issue or there is still bug in Xamarin.Forms? 有没有解决此问题的方法,或者Xamarin.Forms中仍然存在错误?

PopAsync is not paired for PushModalAsync PopAsync不与PushModalAsync配对

You should use PushModalAsync() pair with PopModalAsync(). 您应该与PopModalAsync()一起使用PushModalAsync()对。

And PushAsync() pair with PopAsync(). PushAsync()与PopAsync()配对。

Then you will not found memory leak. 然后你就不会发现内存泄漏。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM