内存泄漏使用InvokeScriptAsync for WebView [英] Memory Leak using InvokeScriptAsync for WebView

查看:93
本文介绍了内存泄漏使用InvokeScriptAsync for WebView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用InvokeScriptAsync方法频繁更新Webview内容。  随着每个通话记忆不断上升,永不退缩。  由于我发送大量数据,因此应用程序通常可在几分钟内达到1.5Gb以上的内存。  无论如何都是
在webview上强行收取Garbage Collect?

I'm updating Webview content frequently using InvokeScriptAsync method.  With each call memory keeps going up and never goes back down.  Since I'm sending large data and quite often the app can reach above 1.5Gb in memory within few minutes.  Is there anyway to force Garbage Collect on webview manually?

我的代码:

webView.Navigate(新的Uri(&) ; ms-appx-web:///html/main.html")) 

webView.Navigate(new Uri("ms-appx-web:///html/main.html")) 

private async void createMemoryLeak(string execute,JsonObject json){

private async void createMemoryLeak(string execute, JsonObject json){

var memoryLeak = await webView.InvokeScriptAsync(" eval",new string [] {" \" ;一些无助于DOM,但真的很长的字符串导致内存泄漏更快的每次点击都存储不断去up.\""});的

var memoryLeak = await webView.InvokeScriptAsync("eval", new string[] { "\"something that does nothing to DOM, but has really long string to cause memory leak faster. With every click memory keeps going up.\"" });

}

这是交易断路器,所以任何帮助将理解

This is deal breaker, so any help will be appreciated.

谢谢

推荐答案

Mark472,

Hi Mark472,

有趣的问题,我将创建一个webview并使用你的代码进行一些测试。

Interesting question, I will create a webview and using your code to do some test.

在我进行一些测试后会更新。谢谢你的理解。

Will update later after I have some test. Thanks for your understanding.

- 詹姆斯


这篇关于内存泄漏使用InvokeScriptAsync for WebView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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