Bug 432872 - The Plasmashell has a memory leak
Summary: The Plasmashell has a memory leak
Status: RESOLVED DUPLICATE of bug 432449
Alias: None
Product: plasmashell
Classification: Plasma
Component: general (show other bugs)
Version: 5.20.5
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: 1.0
Assignee: David Edmundson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-12 23:04 UTC by talewis5
Modified: 2021-03-16 22:59 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Output recieved after restarting Plasmashell from konsole (33.16 KB, text/plain)
2021-03-12 16:04 UTC, talewis5
Details
Some journal logs for Plasmashell (8.30 KB, text/plain)
2021-03-12 16:06 UTC, talewis5
Details

Note You need to log in before you can comment on or make changes to this bug.
Description talewis5 2021-02-12 23:04:12 UTC
There is a memory leak in the Plasmashell. This memory leak is not very severe but it does exist and leads to having to restart Plasmashell every so often. 

This memory leak happens when anything interacts with the Plasmashell. If you click an item on the task bar, open the application menu and click on something there, hover/click on a desktop icon, get a notification, add/remove widgets, change a theme setting, lock then unlock the screen, or any other action that uses the Plasmashell will trigger this memory leak

STEPS TO REPRODUCE:
1 Log into your computer
2 Open Ksysguard and monitor the Plasmashell process.
3 Do something with the desktop such as adding a widget, clicking on a widget, getting a notification, add desktop icons/select desktop icons, open the application launcher menu and hover the mouse on items in the menu and click on them, lock your screen then unlock it, setup a slide show for you desktop background and let it play for a while, ect...
4 Restart the Plasmashell process and repeat step 3 to see again how the memory leak works.
5 Remove some widgets from the desktop, restart the Plasmashell and then repeat step 3 and you will see that removing widgets does cause the Plasmashell to use less RAM, but the memory leak will still happen over time if you interact with any component of the desktop.
 
RESULTS:
After doing all that you will be able to clearly see that the Plasmashell has a memory leak. You will notice that the memory leak is not that bad, and some things cause more of a leak than others, but it is still there and will require restarts of the Plasmashell to prevent using up all of your RAM. How often you will have to do this will depend on how you use your computer and how muck you interact with the desktop.

EXPECTED RESULT:
The Plasmashell should regulate its memory by increasing some then decreasing as you use your computer, but it does not do this. It just continues to increase until you restart the process.

OS:
I am running Fedora 33 KDE Plasma.
I have all the latest updates installed.
I do not have any third party plugins. My desktop is as it was when I installed it from the Fedora iso file.
Comment 1 David Edmundson 2021-02-22 23:41:06 UTC
Please include version numbers.
Please get include a log with heaptrack
Comment 2 talewis5 2021-02-23 22:14:00 UTC
Sorry, I updated with the version number. 5.20.5 is the highest version available on Fedora. Can you tell me how to get that log and I will do so? Just an update, It is possible that the memory leak might be in part caused by the plasmashell and kwin_x11 caching stuff and then not releasing old memory.
Comment 3 Bug Janitor Service 2021-03-10 04:33:43 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 4 Nate Graham 2021-03-10 14:40:36 UTC
We really need a human-readable wiki page that explains how to use it. Sorry that we don't have one yet. In the meantime, perhaps you can make heads or tails of https://milianw.de/blog/heaptrack-a-heap-memory-profiler-for-linux.html
Comment 5 talewis5 2021-03-12 16:04:46 UTC
Created attachment 136616 [details]
Output recieved after restarting Plasmashell from konsole

I used konsole to restart Plasmashell then I played with the desctop environment and as I did I got the following output. I also monitored the memory usage of Plasmashell and saw how the memory usage would increase as I got this output.
Comment 6 talewis5 2021-03-12 16:06:43 UTC
Created attachment 136617 [details]
Some journal logs for Plasmashell

I cleared the journal and restarted my computer. I checked it and saw this in the logs. If I get more I can upload it later.
Comment 7 talewis5 2021-03-12 16:20:26 UTC
I was not able to figure out how to make a heep trace, but I was able to get some log output for Plasmashell that seems to be related to the memory issue. As I played with the desktop I watched the memory usage with ksysguard and saw how as I did things the memory usage whent up and I get the output in the Plasmashell output.txt file. While I dont know the cause of the memory issue it would seem that the developers have some poor programming practices in their code. I believe that if the devs go in and fix what is causing all this log output it would improov the memory problem. It looks to me like the memory problem is being caused by code errors from more than one area of code based on this log output. 

Im sorry there is not much in the journal output.txt. I cleared the journal and restarted my computer. I would have to use it longer to get more journal log data, but I feel that it would be the same as what I get from konsole when I use konsole to restart the Plasmashell.

I think that in order for this problem to be fixed, the devs need to see this log data and fix whatever is causing it. (This log data is not for everything. I did not have time to test everything in the desktop. Also of the things that I tested the Application Launcher widget seem to cause the most memory leak problems.)
Comment 8 David Edmundson 2021-03-14 18:52:36 UTC
The log contains no information. Sorry.

Please include a log created with https://github.com/KDE/heaptrack
 
or at least identify if any specific widget triggers the bug.
Comment 9 David Edmundson 2021-03-14 18:53:18 UTC
Potentially this is 432449

Lets assume so until there is information to the contrary

*** This bug has been marked as a duplicate of bug 432449 ***
Comment 10 talewis5 2021-03-16 22:59:40 UTC
I tried to use that HeapTrack tool, but sadly I can't get it to build. Cmake keeps giving me errors and dnf can't locate some of the needed dependicies(pthread gdb).

The only thing I can tell you is that the biggest cause of the memory leak is that I have found is: the notification widget every time you get a notification, The Application Menu widget, and when I unlock my computer. These three things seem to be the biggest cause of the memory leak, but all the widgets cause some form of a leak.