Page 3 of 3

Re: Feature request

Posted: Fri Sep 04, 2020 12:45 pm
by thefunkyjoint
Student wrote: Fri Sep 04, 2020 8:09 am
thefunkyjoint wrote: Thu Sep 03, 2020 11:58 pm I don't know why but it seems to be working now, with one little issue : the cookies dir i already have before aren't working, i'm having to login again in all websites using this 'new' method ; only after i did this the login data became persistent. Any reason for this ?

Thanks ! :)
In RootCache dir created a file LocalPrefs.json, it is stored there encrypted_key, with it, chromium gets access to the reading cookies in your caches, therefore, previously created cookies he can't read it.
I understood. Thanks for the info, now it's working !

Re: Feature request

Posted: Tue Sep 15, 2020 11:59 am
by thefunkyjoint
Although the change cookies dir procedure is working, i noticed a lot of increase in the memory usage of my app. Even if i close the browser and free TChromium, the memory used by the app increases a lot over time as the user toggles between cookies directories... In fact my app reaches about 3GB of memory usage over time, as the user changes directories often. Is this normal ? :shock:

I also noticed when i close the browser , free TChromium and create it again, new subprocesses are created, but the older ones aren't closed. So over time i can see dozens of subprocesses of my app in task manager :?

Re: Feature request

Posted: Tue Sep 15, 2020 12:16 pm
by salvadordf
If your application uses an empty GlobalCEFApp.cache then change that and use a local directory.

GlobalCEFApp.cache must be a subdirectory of GlobalCEFApp.RootCache too.

Re: Feature request

Posted: Tue Sep 15, 2020 12:54 pm
by thefunkyjoint
Indeed was using an empty GlobalCEFApp.Cache, now it's fixed.

But this is what i found out :

When i first open my app, it creates 4 instances of TChromium. At this point, i have 10 instances of subprocess.exe on Windows task manager.

Now the user wants to change cookies dir, so i do the procedure as talked on this topic (close browser, free TChromium and creates new 4 instances of TChromium with the new cookies dir). Now i have 18 instances of subprocess.exe .

If i repeat the above procedure, i'll have 25 instances of subprocess.exe and so on.

It seems when you close the browser and free TChromium instance, its subprocesses are not closed, so the app keeps consuming more and more memory over time.

In my previous procedure of cookies dir changing , i did not have this issue because i closed the app, open it again and create the new TChromiums with the new cookie dir.

But this new procedure is a lot better because the user don't need to close the app anymore. BUT if this memory usage is normal, i'll need to go back to the previous procedure... Maybe i'm missing something :?

One thing i did not test yet, is to force close the subprocess.exe when i free TChromium, but this does not seem a good practice...

EDIT : I did the same test on the MDIBrowser demo and it does not have the same problem : when i close the mdi form , the subprocess is closed too. The difference between this demo and my app is that on the demo TChromium is created on a new MDI form, on my app its always on the main form. Could this be the an issue ?

Re: Feature request

Posted: Tue Sep 15, 2020 2:07 pm
by salvadordf
I just updated CEF4Delphi and now the MDIBrowser demo shows how to handle several cache directories for new child browsers.

Check the 'Create a new request context for new browsers' checkbox to create independent child browsers and keep the 'Use incognito mode for child windows' checkbox clear to make some tests.

I see processes being created and destroyed automatically when I open several child browsers and then close them with that configuration.
The subprocesses are handled by chromium internally and most of them should close instantly or after a few moments.

As you can see, the MDIBrowser demo always creates a new request context for each child browser and it uses a new cache directory inside the GlobalCEFApp.RootCache directory.

Don't force close subprocesses. Let Chromium decide when they have to be closed when no browser is using them after a while.

Re: Feature request

Posted: Tue Sep 15, 2020 2:36 pm
by thefunkyjoint
Thank you very much Salvador ! The problem was in my code actually :lol: