What CefShutdown actually do ?

Do not post support requests, bug reports or feature requests. Discuss CEF here. Non-CEF related discussion goes in General Discussion!

What CefShutdown actually do ?

Postby pjaholkowski » Fri Jan 29, 2021 7:20 am

When I run windows process It uses 4 threads when EIP reaches main function.
Calling CefExecuteProcess loads libcef.dll and creates bunch of threads.
When application calls CefShutdown libcef.dll is still loaded and there
is list of previously created bunch of threads (versioncef_binary_88.1.6).
I did my test on cefsimple and cefclient samples
pjaholkowski
Newbie
 
Posts: 3
Joined: Fri Jan 29, 2021 7:14 am

Re: What CefShutdown actually do ?

Postby magreenblatt » Fri Jan 29, 2021 10:24 am

It tears down internal objects and writes data to disk if cache is enabled.
magreenblatt
Site Admin
 
Posts: 10860
Joined: Fri May 29, 2009 6:57 pm

Re: What CefShutdown actually do ?

Postby pjaholkowski » Fri Jan 29, 2021 10:48 am

Thank you for your answer. But now I'm really curious.
What is purpose of tearing down internal objects ?
And if answer is freeing up memory then my next question is: "If we care
about freeing up memory after internal objects why don't we care about zombie threads
and memory allocated by libcef.dll ?"
pjaholkowski
Newbie
 
Posts: 3
Joined: Fri Jan 29, 2021 7:14 am

Re: What CefShutdown actually do ?

Postby magreenblatt » Fri Jan 29, 2021 11:27 am

If you're not using a disk cache and you exit with something like TerminateProcess() then you don't need to call CefShutdown. If you want your application to exit normally without crashing then CefShutdown is required to tear down internals in the correct order. All memory will be freed in either case when the application terminates.
magreenblatt
Site Admin
 
Posts: 10860
Joined: Fri May 29, 2009 6:57 pm

Re: What CefShutdown actually do ?

Postby pjaholkowski » Mon Feb 01, 2021 7:22 am

OK this is how all modern operating systems work. They clean up resources
of killed process. I was rather suprised that CefShutdown does not clean
all allocated resources. Why ? Because we don't know how programmer is going
to use distributed library. Programmer can decide to use CEF once only
on program start and do not use it anymore or use it occasionaly
during program lifetime. This is why denit functions of dynamic libraries
always clean up all alocated resources during library usage.
In the first case not freeing up resources leads up to memory leakage.
Which in CEF case is something around 100MB (size of libcef.dll and snapshot bin)
CEF is really advanced project and I did not think It was made by
mistake but rather by purpose so this is why I asked this question in the first place.
I understand why CEF does not free up resources in separate render processes
which would be destroyed either way when browser window is closed. What I don't
understand is why it does not free libcef.dll library in browser process when CefShutdown is called.
I found your response to this thread https://magpcss.org/ceforum/viewtopic.php?f=6&t=16631
and now everything is clear to me. Thank you
pjaholkowski
Newbie
 
Posts: 3
Joined: Fri Jan 29, 2021 7:14 am


Return to CEF Discussion

Who is online

Users browsing this forum: No registered users and 3 guests