WebBrowser控件内存使用率很高 [英] webbrowser control memory usage high

查看:246
本文介绍了WebBrowser控件内存使用率很高的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于系统内存的问题。
我已经集成我的应用程序中的网络浏览器。网上冲浪,内存使用率越来越长大..显然它的Windows Phone,在网页浏览(至少在浏览器)管理内存,所以我不应该有任何内存异常。当我离开的看法在浏览器上的问题发生:我的内存使用率仍然很高。我说的是50-60MB或90/95 MB(在某些站点)。我试着没有任何成功退出执行内存清理......如果我以这种方式使用的应用程序,我肯定会陷入内存异常,因为内存使用量不降

I have a question about system memory. I have integrated a web browser within my application. Surfing the web, the memory usage grows up more and more.. apparently it’s windows phone that manages memory during pages browsing (at least for the browser), so i should not have any memory exception. The problem happens when I leave the view on the browser: my memory usage remains HIGH. I’m talking about 50-60MB or 90/95 MB (on some site). I’ve tried to perform a memory clean on exit without any success… if i use the app in this way I certainly will fall into a memory exception because the memory usage never goes down

protected async override void OnNavigatedFrom(NavigationEventArgs e)
    {

        await Browser.ClearInternetCacheAsync();
        await Browser.ClearCookiesAsync();

        ContentPanel.Children.Remove(Browser);

        GC.Collect();
        GC.WaitForPendingFinalizers();
        GC.Collect();
    }

有没有人有一个解决这个问题?
请让我知道

Does anyone has a solution to this problem? Please let me know

推荐答案

您做从OnNavigatedFrom的code复制到OnNavigatingFrom和喜欢,而只有冲浪,而不是在最后阶段,即OnNavigatedFrom应用程序的各个阶段,因为这是问题仅与该控制。
也尝试调用等待新的web浏览器()。ClearCookiesAsync()之前,每一个Web浏览器会话之后

You do copy the code from OnNavigatedFrom to OnNavigatingFrom and at various stages of app like while surfing only,not at last stage i.e. OnNavigatedFrom ,as this is issue with that control only. also try calling await new WebBrowser().ClearCookiesAsync() before and after every web browser session.

这篇关于WebBrowser控件内存使用率很高的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆