Page 1 of 1

Tell me is it possible to encapsulate the Chromium component?

Posted: Sun Mar 13, 2022 2:11 pm
by yarockiisergei
Hello. Tell me is it possible to encapsulate the Chromium component? The problem is that there are sites with memory leaks, if the exe page is open for a long time, it closes due to overflow. I wanted to monitor the growth of memory and if it reaches the specified limit, the page will be reloaded.

Re: Tell me is it possible to encapsulate the Chromium component?

Posted: Sun Mar 13, 2022 2:36 pm
by salvadordf
Hi,

Yes, it's possible to encapsulate the browser in your application.

BriskBard uses CEF4Delphi and WebView4Delphi to embed Chromium-based web browsers :
https://github.com/salvadordf/CEF4Delphi
https://github.com/salvadordf/WebView4Delphi

Please, let me know the URL of those pages with leaks to fix this issue.

Re: Tell me is it possible to encapsulate the Chromium component?

Posted: Sun Mar 13, 2022 3:25 pm
by yarockiisergei
Any js code can cause a memory leak, for example
, setInterval(() => {window.i=window.i+'432434243432443243';}, 1);

Re: Tell me is it possible to encapsulate the Chromium component?

Posted: Sun Mar 13, 2022 5:58 pm
by salvadordf
That kind of errors should be debugged and fixed by the developers of that web page using the developer tools (DevTools) available in the browser.

Re: Tell me is it possible to encapsulate the Chromium component?

Posted: Sun Mar 13, 2022 6:56 pm
by yarockiisergei
I agree with you 100%, but the developers of their resources are people not controlled by the browser. And in Delphi, I place a component that should be able to deal with this, at least to understand that memory has reached a critical threshold and it is necessary to forcibly update the page. Is there a function that will return the size of the occupied memory of the browser page?

Re: Tell me is it possible to encapsulate the Chromium component?

Posted: Mon Mar 14, 2022 8:33 am
by salvadordf
I'll have to investigate if Chromium exposes any setting or command line switch that helps in come of these cases.