【问题标题】:Do I need to clean up memory myself in xamarin.forms?我需要自己在 xamarin.forms 中清理内存吗?
【发布时间】:2020-08-02 11:26:51
【问题描述】:

我有一个登录页面。授权后,用户被带到另一个页面。

Device.BeginInvokeOnMainThread(() =>
 {
     Application.Current.MainPage = new Main_Page();
 });

我应该以某种方式清除为登录页面分配的内存吗?

【问题讨论】:

  • 不,GC 会处理的

标签: c# xamarin memory xamarin.forms


【解决方案1】:

绝对不是,它是自动完成的。

【讨论】:

    【解决方案2】:

    如果您查看 Xamarin PageRenderer 代码 here。 Xamarin Page 类已实现 Dispose() 方法。所以 Page 应该被 GC 清理掉。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-06-27
      • 1970-01-01
      • 1970-01-01
      • 2011-06-29
      • 2013-09-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多