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.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.
You can only call TChromium.CreateBrowser after GlobalCEFApp.GlobalContextInitialized is set to True and GlobalCEFApp.GlobalContextInitialized is set to True right before the GlobalCEFApp.OnContextInitialized event is triggered.
There are a couple of ways to know when you can call TChromium.CreateBrowser :
The best way would be to use the GlobalCEFApp.OnContextInitialized event but it's a little complicated because that event is triggered in a different thread and it can be executed before or after the main form is created. You could use a critical section to synchronize that event with the TForm.OnShow event where the TChromium.CreateBrowser function is usually called.
If you want a simple but effective solution you could also use a timer. All the demos use that solution to keep them as simple as possible.
dilfich wrote: Mon Feb 12, 2018 8:26 am
I create 20 pieces of OSR, after 10 hours of work take about 3GB of memory, is it normal or am I doing it wrong?
Made a cache on the disk, now memory is an order of magnitude less.
If we have the ability to clear the cache while you work?
dilfich wrote: Sat Feb 17, 2018 5:44 amIf we have the ability to clear the cache while you work?
No. It's not possible to delete the cache while your app is running. Try deleting it before calling GlobalCEFApp.StartMainProcess.
That is, if the path to the cache is specified here GlobalCEFApp, but if it is listed after the run in TCefRequestContextRef.New?
GlobalCEFApp.DeleteCache then not helps..
When you set GlobalCEFApp.DeleteCache to True before calling GlobalCEFApp.StartMainProcess then GlobalCEFApp will delete the GlobalCEFApp.cache directory before initialization.
As far as I know, CEF3 doesn't allow to delete the cache contents while it's initialized.
I've never tried to delete the cache using different contexts and closing all the browsers using them but I wouldn't be surprised if some processes remain in memory locking the cache.