Freeing all memory of the QWebEngine (and Qt Quick)
-
My app uses around 80MB of RAM, but if I add a webengine it spawns three QtWebEngineProcesses, and the app process's memory usage jumps to 200MB. Simply linking to WebEngineWidgets increases ram use by 30MB, so I made a separate .so that handles the browser side of things and returns an interface I can use to manage the QWebEngineView.
Loading my library and showing the browser works great. The window does disappear for a bit (as it switches to OpenGL rendering?).
However, I can't free the memory that the QWebEngineView consumes, along with the processes it spawns and the Qt Quick widget allocations it does. Deleting the QWebEngineView and it's page isn't enough.
If I dlclose() the library after cleanup, doing anything in the app crashes (maybe because the renderer is not switched back?).
My cleanup code is as follows:
webEngineView->setParent(nullptr); webEngineView->hide(); webEngineView->page()->deleteLater(); webEngineView->setPage(nullptr); webEngineView->close(); delete webEngineView; webEngineView = nullptr; //dlclose(dl_handle) //dl_handle = nullptr;
How can I switch back the renderer (making the window disappear and reappear)?
How can I fully kill all QtWebEngineProcesses and free the memory they use?
How can I free the other memory that is used by the QWebEngineView?If it matters:
I am using Qt6 (6.5.0) on Arch Linux.
I have an AMD graphics card, using open source (mesa) drivers.