Bug 237837 - Memory leak in plasma-desktop
Summary: Memory leak in plasma-desktop
Status: RESOLVED FIXED
Alias: None
Product: plasma4
Classification: Plasma
Component: general (show other bugs)
Version: 4.8.4
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
: 241690 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-05-16 16:38 UTC by Stan Thorovsky
Modified: 2014-03-01 11:16 UTC (History)
11 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
plasma desktop memory usage (90.95 KB, text/plain)
2010-06-08 10:12 UTC, SlashDevDsp
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stan Thorovsky 2010-05-16 16:38:33 UTC
Version:            (using KDE 4.4.2)
OS:                Linux
Installed from:    Ubuntu Packages

Plasma-desktop RAM usage invariably goes to well over 1 gig after 3-4 days of continuous KDE usage.

Widgets in use: 
Application Launcher (default)
Battery Monitor
Device Notifier

Digital Clock
Folder View (2x)
Message Indicator
Pager
Quick Access
Show Desktop
System Tray
Task Manager
Trashcan;

2 Workspaces but only 1 plasma activity;

2 panels.
Comment 1 Marcelo Bossoni 2010-05-18 23:19:20 UTC
Hi,
I have this same annoying bug.
I have basically the same configuration (without the Battery monitor) and I got this same issue.
As workaround I'm logging out/in to restart plasma, but it is too sad :(
Voting to this bug too.
Comment 2 Marcelo Bossoni 2010-05-18 23:19:44 UTC
I forgot to mention that I'm using KDE 4.4.3
Comment 3 Stan Thorovsky 2010-05-19 00:52:56 UTC
(In reply to comment #1)
> Hi,
> I have this same annoying bug.
> I have basically the same configuration (without the Battery monitor) and I got
> this same issue.
> As workaround I'm logging out/in to restart plasma, but it is too sad :(
> Voting to this bug too.

Hi Marcelo,
Just a quick note on simple fix with no need to log out: get Yakuake installed and running, kill plasma-desktop process in System Monitor - all your open programs will continue running, start plasma-desktop using Yakuake with:
plasma-desktop &
That should bring its RAM usage back to 20-30M.
Hope this helps a bit - of course it's not a proper fix.
Comment 4 Marcelo Bossoni 2010-05-19 01:14:29 UTC
This is a little quicker than log out method.
thx.
Comment 5 jared 2010-05-20 04:14:04 UTC
I also am experiencing a memory leak in plasma-desktop.  I have kubuntu 10.04 x86_64 with kde 4.4.2, and nvidia proprietary drivers 195.136.15.  My plasma-desktop process starts at about 65M RSS and grows by ~60M per hour.  pmap shows the increased memory is coming from an anonymous data segment, xrestop shows no increase in pixmap memory for the plasma-desktop process.

I think I'll be able to reproduce this bug.  By removing my ~/.kde directory, I was able to make the leak stop.  So it's gotta be some configuration thing.  I'll continue to work on this and see if I can reproduce the config that makes the leak.
Comment 6 Aaron J. Seigo 2010-05-21 18:14:22 UTC
these two items:

* Message Indicator
* Quick Access

are third party, non-standard add-ons. can you try running without them (one at a time!) and see if the problem goes away at that point?

if they aren't the problem, then keep removing widgets until the problem ceases. then report back with the problem widget. note that i won't keep this particular report open for more than a week without additional details, since there isn't enough information currently provided to be able to take any concrete actions.

btw, you don't need yakuake (though it's an _awesome_ app :) .. just alt+f2 to bring up krunner and type: kquitapp plasma-desktop<enter>, then alt+f2 again and plasma-desktop
Comment 7 Stan Thorovsky 2010-05-21 20:45:33 UTC
I'll try to narrow it down - have started with removing message indicator. Maybe someone else with the same problem can try with a different widget to speed things up?
Comment 8 Stan Thorovsky 2010-05-22 01:02:33 UTC
Quick update: Message Indicator widget is not the culprit. Testing now without Quick Access.

Also I have possibly noticed something else - memory leak does not manifest itself (or at least not as strongly) if plasma-desktop is killed and then restarted from Yakuake - this way I had plasma-desktop running for 2 days without noticeable memory usage increase.
Comment 9 Aaron J. Seigo 2010-05-22 02:43:39 UTC
also, information on the following would be useful:

* is the RAM usage x11 pixmap usage, or "regular" RAM usage?
* desktop effects on?
* what video driver?

thanks.
Comment 10 Stan Thorovsky 2010-05-22 09:38:28 UTC
Aaron,

Video driver: i915
Desktop effects: on (I don't think turning them off makes a difference but I might be wrong - will test in a couple of days)
RAM usage: "regular"

Update: eliminated Quick Access & Digital Clock, currently testing with no Folderview
Comment 11 Stan Thorovsky 2010-05-23 02:21:31 UTC
Update:
I think I caught it - removing System Tray stopped memory leak.

Since last update I eliminated one by one Folderview, Battery Monitor, Pager, Device Notifier and Application Launcher.

Now, having removed System Tray, I am left with only Task Manager, Show Desktop and Trashcan with memory usage for plasma-desktop hovering at around 15 megs. I'll restore  my original set of widgets excluding System Tray and test it over the next day. I'll report back and if there is no memory leak I'll add System Tray back and try to play around with it to see if I can affect its memory usage.

Aaron, is there anything specific I can do to help and pinpoint the issue?
Comment 12 Marcelo Bossoni 2010-05-23 18:15:38 UTC
I can confirm that removing system tray solved the problem..

Removing systray solved another problem too: sometimes the entire plasma freezes during a file transfer (maybe the notification applet is the problem in this case)
Comment 13 Stan Thorovsky 2010-05-23 18:41:54 UTC
Update:
I managed to pinpoint the issue causing memory leak. 
It is a combination of Strigi File Indexer and plasma-desktop (Strigi applet in System Tray). Here is what's happening: Strigi re-indexes certain files/folders around every 10 mins (on an idle system and more often when files are accessed); during re-indexing process not only nepomukservicestub claims CPU usage (as would be expected), but also plasma-desktop goes to 10-17% CPU usage; during that time plasma-desktop adds between 2-4M to its RAM usage which is then never reclaimed. On my system most common RAM increase was 3.9-4M with 2-3M increase less often. So on an idle system (i.e. left overnight) plasma-desktop will increase it RAM usage at least 6 times an hour. All this is in spite of Strigi applet being hidden by default in System Tray and therefore producing no visual output.
As the result memory leak can be stopped by: 1) disabling Strigi File Indexing in System Settings; or 2) removing System Tray widget.

Let me know if additional details are required.
(Note: reporting RAM can be tricky, so all figures are simply from Ksysguard memory column)
Comment 14 Marcelo Bossoni 2010-05-23 20:57:12 UTC
Man,
Strigi indexer... Really tricky....
I'm disabling strigi and keeping systray just to confirm here. :D
Comment 15 Marcelo Bossoni 2010-05-24 14:47:46 UTC
Just reporting:

With strigi disabled and using System Tray worked. No (large amounts of) memory increase.

Thanks Stan Thorovsky for this workaround :D. Now I can leave my pc on all night long.
Comment 16 jared 2010-05-25 22:07:54 UTC
Disabling strigi also stopped the leak for me.  I have been trying unsuccessfully for the last several days to reproduce this error on a virtual machine....grrr....
Comment 17 Stan Thorovsky 2010-05-25 22:15:37 UTC
I have just upgraded to 4.4.3 via kubuntu-ppa - unfortunately the bug is still there
Comment 18 jared 2010-05-26 00:27:15 UTC
Noooooooo...... re-enabling strigi did not cause the leak to come back.  I am
unable to reproduce the error.
Comment 19 J Queiroz 2010-05-26 04:54:40 UTC
I'm suffering the same problem in two machines, both using KDE 4.4.3 64bits.

Interestingly, I have a third machine that doesn't seems to suffer the problem, but I'm not sure now which is the version of plasma running on it.

I also disabled strigi/nepomuk in one of the machines, and will monitor it's memory usage periodically, to confirm the workaround.
Comment 20 SlashDevDsp 2010-06-08 10:08:32 UTC
This is the detailed memory info on plasma-desktop from ksysguard. Its too big so I am adding the details as attachment
Comment 21 SlashDevDsp 2010-06-08 10:12:34 UTC
Created attachment 47807 [details]
plasma desktop memory usage
Comment 22 SlashDevDsp 2010-06-08 10:14:23 UTC
memory info is with today svn trunk compiled. plasma-desktop with twinview with 1 activity (default) current memory usage is 185.4MB and increasing (refer to the previous attachment)
Comment 23 SlashDevDsp 2010-06-08 10:22:12 UTC
I must also add that this is with twinview (2 lcd's @1680x1050 each) 256.29 nvidia binary blob with *trilinear* texture filtering, 1 panel, 1 folderview. Nepomuk and strigi are disabled.
Comment 24 Aaron J. Seigo 2010-06-08 19:14:51 UTC
unfortunately, the memory stats info doesn't really help at all. but tracking it down to the system tray does. it's related either to jobs or notifications, and we know of a leak in the notifications (haven't pinpointed it to the exact lines of code, but we know the general area at least) ... thanks for the testing and follow up to those who did so :)
Comment 25 SlashDevDsp 2010-06-09 06:26:53 UTC
I have just confirmed a way to increase the plasma memory usage :)

Logout and relogin and do the following:
open ksysguard and check plasma-desktop usage: say 50MB

Now right click desktop->Desktop settings->wallpaper
Type:Image, Positioning:Tiled

1. Now click on the scrollbar and scroll through (drag the scrollbar with the mouse all the way from the top to the bottom) all the wallpapers at a relatively moderate speed(meaning all the wallpapers should just scrollby).

Check plasma-desktop memory usage: gone up by 15-20MB.

If that didnt increase the memory usage:
click open and add a new wallpaper (I use 1920.x1200) wallpaper
Now try (1) again. I will increase memory.

I have confirmed that after every 20min if you run 'right click->Desktop Settings' and do (1) it increases memory by 12-20MB again.

If you run 'desktop settings' do (1) and close 'desktop settings' and rerun 'desktop settings' and do (1) the memory usage does *not* increase. Its just that if you happen to run desktop settings after a long time (say 30 mins) it definitely increases the plasma-desktop memory usage.
Comment 26 SlashDevDsp 2010-06-09 11:56:05 UTC
Ahh I just found out for my previous comment #25 the memory seems to increase by about 20Mb for about 3 instances only, Any number of invocations after the first 2 instances does not seem to increase plasma-desktop memory.

I am not sure why the memory increased the second time when everything should have been in cache upon the first load of 'desktop settings' as nothing was changed.
Comment 27 Tom 2011-04-13 03:56:30 UTC
*** This bug has been confirmed by popular vote. ***
Comment 28 Reza 2011-12-23 11:37:56 UTC
*** Bug 241690 has been marked as a duplicate of this bug. ***
Comment 29 Shmerl 2012-07-11 19:25:42 UTC
Even though this bug is marked as resolved fixed (not sure in what version of KDE though), this bug is still present for me. Removing system tray as noted above solves the issue. So this bug must be still present even in KDE 4.8.4

Current up to date Debian Linux testing x86_64. Nvidia closed driver (302.17.3). Desktops effects enabled (OpenGL compositing). plasma-desktop version (in Debian): 4:4.8.4-3
Comment 30 Shmerl 2012-07-11 19:30:27 UTC
Just to note, this bug is not present when desktop effects are disabled or set to Xrender compositing.
Comment 31 Shmerl 2012-07-11 20:11:01 UTC
OK, taking it back - leak is present even with Xrender.
Comment 32 Myriam Schweingruber 2012-09-04 21:33:55 UTC
Reopening based on several comments.
Comment 33 Shmerl 2012-09-04 21:43:01 UTC
Related: Bug #303625 ( https://bugs.kde.org/show_bug.cgi?id=303625 )
Comment 34 Aaron J. Seigo 2012-09-04 22:03:00 UTC
seems the re-report is related to behaviour specific to a given GPU/driver combination, not the original bug (and why i severely dislike bugs with such vague titles as this ... )
Comment 35 boblovgren55 2014-02-03 21:54:32 UTC
This bug is not fixed. On openSUSE 13.1 x64, plastma-desktop consumes more and memory with regular desktop usage. The only way to fix it with the default out of the box settings is to restart the computer. Telling people to disable desktop effects is not a fix. Why was this bug closed when it obviously still exists?
Comment 36 Shmerl 2014-02-03 22:05:07 UTC
@boblovgren55: I was able to isolate this bug to one particular custom application (which used Ruby+Qt bindings) which was creating an entry in the system tray. It was buggy, but the process which was leaking memory was plasma-desktop, because of the way the system tray is handled.

xrestop demonstrated constant growth of resources usage when that application was running. Try to isolate the leak. First run the desktop without anything additional (no extra widgets and so on). See xrestop. Then add stuff one by one and monitor at what point you can observe the leak.
Comment 37 boblovgren55 2014-02-03 22:24:14 UTC
I don't have any additional widgets except a few desktop widgets. It's a vanilla install. The more I use the computer, the more plasma-desktop grows in memory usage. In xrestop, kwin is taking up the most amount of memory. There's not much to isolate, because I don't have anything to isolate. Personally, I don't think this bug is fixed.
Comment 38 Shmerl 2014-02-03 22:26:31 UTC
> The more I use the computer

So you do use it, I guess it means running various stuff. What I'm trying to say is, that some application can cause the leak in the plasma-desktop. Is there a leak when you don't use the computer (but just run a default desktop without any applications)?
Comment 39 boblovgren55 2014-02-03 22:41:20 UTC
It seems as though the more I use the computer, the more the memory increases. If I just let it sit, it stays stable. I also notice Xorg increases in memory usage over time, so I wonder if these two things are related.
Comment 40 boblovgren55 2014-02-04 23:14:44 UTC
The leak happens when adding widgets to the desktop. When the widgets are closed, memory is not freed. The more widgets which are added, the more memory plasma-desktops takes.
Comment 41 boblovgren55 2014-02-04 23:19:12 UTC
Can we please re-open this bug report?
Comment 42 Christoph Feck 2014-03-01 11:16:42 UTC
Please open a new bug report with exact steps to reproduce. Also, how do you measure memory usage? Note that glibc does (and usually can) not shrink the heap size on each deallocation, so what you see might be out of the scope of Plasma developers.