Hi, how do I dispose or shutdown a webview coz it is not working due to out of memory exception (OOME).
here is my code which is working unless I have multiple scraper running. it triggers the out of memory error, and when I checked my task explorer, it has around 20 EO worker process taking up around 89% of memory usage.
I tried adding a
Quote:webView.Close(true);
but it is giving me an error "
Destroy must be called from the same thread the WebView is created". Can someone pls tell me how to dispose and possibly avoid OOME? thanks
Quote:EO.WebEngine.Engine engine = EO.WebEngine.Engine.Create("enginetest");
using (threadRunner = new ThreadRunner("test thread", engine))
{
var proxy = ProxyHelper.GetProxy();
if (threadRunner.Engine != null)
{
threadRunner.Engine.Options.Proxy = new EO.Base.ProxyInfo(EO.Base.ProxyType.HTTP, proxy.Address,
proxy.Port, proxy.Username, proxy.Password);
}
using (WebView webView = threadRunner.CreateWebView(new EO.WebEngine.BrowserOptions() { LoadImages = false }))
{
var customResourceHander = new CustomResourceHandler();
webView.RegisterResourceHandler(customResourceHander);
threadRunner.Send(async () =>
{
await webView.LoadUrlAsync(url);
});
int waitCounter = 0;
while (customResourceHander.Content == string.Empty || waitCounter++ > 30)
{
Thread.Sleep(200);
}
threadRunner.Dispose();
return customResourceHander.Content;
}
}