Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

Tell me is it possible to encapsulate the Chromium component?

Post Reply
yarockiisergei
Posts: 6
Joined: Wed Aug 18, 2021 10:44 pm

Tell me is it possible to encapsulate the Chromium component?

Post 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.
User avatar
salvadordf
Posts: 4056
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

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

Post 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.
yarockiisergei
Posts: 6
Joined: Wed Aug 18, 2021 10:44 pm

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

Post by yarockiisergei »

Any js code can cause a memory leak, for example
, setInterval(() => {window.i=window.i+'432434243432443243';}, 1);
User avatar
salvadordf
Posts: 4056
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

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

Post 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.
yarockiisergei
Posts: 6
Joined: Wed Aug 18, 2021 10:44 pm

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

Post 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?
User avatar
salvadordf
Posts: 4056
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

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

Post by salvadordf »

I'll have to investigate if Chromium exposes any setting or command line switch that helps in come of these cases.
Post Reply