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.

Optimization

dilfich
Posts: 330
Joined: Thu Nov 30, 2017 1:17 am

Optimization

Post by dilfich »

Hi!
What can be disabled to make the browser consume a minimum of resources?
User avatar
salvadordf
Posts: 4057
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Optimization

Post by salvadordf »

Hi,

Try disabling everything you don't really use. In that list you could have JavaScript, images, plugins, webgl, etc.
Many of those options can be disabled in TChromium.Options.

There are several GlobalCEFApp properties that might affect RAM usage.
Try disabling GlobalCEFApp.FlashEnabled, GlobalCEFApp.EnableMediaStream or GlobalCEFApp.EnableSpeechInput.
If you don't want to use too much RAM then specify a GlobalCEFApp.cache directory.
If you enable GlobalCEFApp.EnableGPU you might see lower CPU usage but it could cause problems with some unsupported graphics cards.

It would be interesting to compare the RAM usage between TChromium in normal mode and off-screen mode (OSR) with a reduced virtual screen size.

I'm probably forgetting more features you can disable... :roll:
dilfich
Posts: 330
Joined: Thu Nov 30, 2017 1:17 am

Re: Optimization

Post by dilfich »

If not a disk cache to clear, maybe there's a way to release memory?

If you call..
CloseBrowser (True);
You can delete\clear the cache, but how to resume work?
User avatar
salvadordf
Posts: 4057
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Optimization

Post by salvadordf »

The number of processes, cache handling and other memory management is done internally in Chromium.
All you can do is destroy browsers that are no longer used and wait until Chromium frees all their associated resources.
User avatar
salvadordf
Posts: 4057
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Optimization

Post by salvadordf »

dilfich wrote: Tue Jun 12, 2018 9:13 am If you call..
CloseBrowser (True);
You can delete\clear the cache, but how to resume work?
Depends on your definition of "resume work". You can create a new browser with the same request context and your cookies and cache will be reused.
dilfich
Posts: 330
Joined: Thu Nov 30, 2017 1:17 am

Re: Optimization

Post by dilfich »

salvadordf wrote: Tue Jun 12, 2018 9:27 am Depends on your definition of "resume work". You can create a new browser with the same request context and your cookies and cache will be reused.
Yes, I do. But there is another problem, why not all memory is freed? :?
User avatar
salvadordf
Posts: 4057
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Optimization

Post by salvadordf »

I don't know. :oops:

I don't work at Google and I'm not a part of the Chromium project. I don't know why the Chromium developers decided to do that.
dilfich
Posts: 330
Joined: Thu Nov 30, 2017 1:17 am

Re: Optimization

Post by dilfich »

And how can I display the memory occupied by the application when there are many processes?
For example, this method does not work..
function CurrentProcessMemory: Cardinal;
var
MemCounters: TProcessMemoryCounters;
begin
Result := 0;
MemCounters.cb := SizeOf(MemCounters);
if GetProcessMemoryInfo(GetCurrentProcess,
@MemCounters,
SizeOf(MemCounters)) then
Result := MemCounters.WorkingSetSize
else
RaiseLastOSError;
end;
User avatar
salvadordf
Posts: 4057
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Optimization

Post by salvadordf »

I quick google search shows these possible methods to get the memory usage :
https://stackoverflow.com/questions/437 ... hi-program
http://www.swissdelphicenter.com/en/sho ... hp?id=2276
dilfich
Posts: 330
Joined: Thu Nov 30, 2017 1:17 am

Re: Optimization

Post by dilfich »

salvadordf wrote: Tue Jun 12, 2018 9:40 am I don't know. :oops:
I don't work at Google and I'm not a part of the Chromium project. I don't know why the Chromium developers decided to do that.
Or maybe CloseBrowser is not enough and you need something else to call?
Post Reply