-
Notifications
You must be signed in to change notification settings - Fork 0
Memory
devlinman edited this page Jan 25, 2026
·
4 revisions
- WhatsApp stores all the encryption keys, messages, and encryption algorithms in webpage memory. This is more or less needed for the end-to-end encryption security guarantees.
- Is it a design flaw? YES. Can we do something about it? NO.
- I tried to decode the cached messages on disk, tried to separate the graphics renderer (view) from the message notifier, etc.
- None of these approaches worked for me. Eventually I just accepted defeat.
- The core app spawns a few
QtWebEngineProcess --type=rendererprocesses. They consume memory whenweb.whatsapp.comis rendered.
- Enabling
Use Less Memorytoggle will unload the webpageweb.whatsapp.comand keep a_blankpage in QWebEngineView when the app is hidden. - When the app is raised or shown, the view is forced to load
web.whatsapp.comagain.
Warning
If you enable Use Less Memory, the webpage is temporarily closed. but the app remains in tray. CPU consumption will increase each time the app is opened and the webpage is loaded.
- Enabling the Kill switch will start a timer process (starts at app launch) which checks for the app's RSS (Resident Set Size = memory pages currently in RAM.) and exits the app if it is greater than the threshold given by the user.
- Note that RSS is only an approximation/guesstimation of the app's actual memory footprint.
- It may be better to use PSS (Proportional Set Size) but for now, we are using RSS.
- Drawbacks of using RSS: double-counts shared library pages in memory. So in effect, the kill switch may be activated prematurely, even when the actual memory consumption is lower than the threshold.
- Note that neither RSS nor PSS will give the memory readout that you may see from a System Monitor App (like the one in KDE).
- Accurate total memory footprint for our app is given by summing its own PSS, and PSS of all its QtWebEngine subprocesses recursively over the child process tree.
- You can try writing a shell script that can take the pid of the app and calculate this mess.
- Implementing such a convoluted and complicated approximation will make the app more complicated than it needs to be. It is a C++ app after all...
- Like all things in life, it is about balance.
- if you are frequently using the app, then keep the app in memory. Disable
Use Less Memory. - Alternatively, remove old/unused chats. Each chat has its own encryption keys, etc. so decreasing the number of chats will reduce memory usage.
- If you need the app to autostart, but you don't use the app often, use the toggle. Rest assured that the app will load WhatsApp Web when you need to send a message/check messages.
created by devlinman