Bug 430139

Summary: plasmashell has a memory leak
Product: [Plasma] plasmashell Reporter: Alberto Salvia Novella <es20490446e>
Component: generic-performanceAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED DOWNSTREAM    
Severity: normal CC: bednarczyk.pawel, es20490446e, nate, plasma-bugs, thomwalker732
Priority: NOR    
Version: 5.20.4   
Target Milestone: 1.0   
Platform: Manjaro   
OS: Linux   
URL: https://forum.manjaro.org/t/plasmashell-has-a-memory-leak/41892
See Also: https://bugs.kde.org/show_bug.cgi?id=466320
Latest Commit: Version Fixed In:
Attachments: screenshot
valgrind trace

Description Alberto Salvia Novella 2020-12-08 07:21:01 UTC
Created attachment 133931 [details]
screenshot

After a single day running RAM is completely depleted.
Comment 1 Nate Graham 2020-12-08 16:11:23 UTC
Do you have any 3rd-party widgets in use?
Comment 2 Alberto Salvia Novella 2020-12-08 21:59:01 UTC
No, it's the most minimalist desktop possible:
https://i.imgur.com/RqnbT6T.png

Although Deepin and Cinammon are also installed on this system.
Comment 3 Alberto Salvia Novella 2020-12-10 08:01:07 UTC
After uninstalling the rest of desktop environments the problem seems gone.
Comment 4 Alberto Salvia Novella 2020-12-15 04:33:52 UTC
Not gone.

Perhaps auto-reseting plasmashell would be a good idea if it is detected that the difference of RAM during boot and later on is quite different.

Perhaps there could be a timer which checks for that hourly.
Comment 5 Alberto Salvia Novella 2020-12-15 04:47:03 UTC
The commands for restart are:
killall plasmashell; plasmashell > /dev/null 2>&1 & disown
Comment 6 Alberto Salvia Novella 2020-12-15 16:00:52 UTC
If an app that disables composition is launched, RAM returns to its nominal value.
Comment 7 Quartz 2021-10-21 18:19:26 UTC
Bump x4. 

I'd appreciate if this bug takes priority - it might be causing other accidental threads being created in relation to memory leaks and mistaking side effects in other places (such as I did with plasma widgets).

It makes it impossible to keep a desktop linux distro running KDE for several days and it's making the desktop environment give a really poor impression and experience.
Comment 8 Alberto Salvia Novella 2021-10-21 18:32:01 UTC
I discovered a while ago that, in my case, the leak was caused by a tray icon: qsyncthingtray.

Yet it would be smart that the plasma service has a maximum memory limit. Systemd allows that, and automatically restarts the service once reached.

For the moment I'm using the following software to accomplish that:
https://gitlab.com/es20490446e/plasma-leakguard
Comment 9 Pawel 2023-02-24 23:04:18 UTC
Created attachment 156694 [details]
valgrind trace

I am not sure if it's the same underlying issue, but in my case plasma's memory footprint grows from 275 mb to 20GB if I don't restart it.  Attaching a valgrind trace, unsure how useful
Comment 10 Pawel 2023-02-24 23:06:10 UTC
that was a screenshot, here is the valgrind file. too big to attach

https://mega.nz/file/J0AhFIwK#pI_pFGmN8gWZCjHAjeuo1APerJ1rWoJavFPuwq3o1eo
Comment 11 Pawel 2023-02-25 11:20:18 UTC
https://mega.nz/file/o8pBARSY#QxC_k6BYt84bSUQje7RI74QNqMwYA9UjIuf3iMSFdMg

video of plasmashell memory usage growing to 22GB in the space of less than 3 minutes.
Comment 12 Nate Graham 2023-02-27 15:26:56 UTC
Pawel, please submit a new bug report for your issue because there's almost no chance it's caused by the same issue as this bug. Almost every memory leak has a different root cause. Thanks!

Alberto, since it seems like your issue was caused by a misbehaving 3rd-party app, I'll close this now. Please do submit a bug report for the developers of qsyngthingtray!