Bug 294001 - Big memory leak in kactivitymanagerd when switching activitys
Summary: Big memory leak in kactivitymanagerd when switching activitys
Status: RESOLVED FIXED
Alias: None
Product: kactivitymanagerd
Classification: Plasma
Component: general (show other bugs)
Version: unspecified
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Ivan Čukić
URL:
Keywords:
: 294926 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-02-13 16:08 UTC by Anselmo L. S. Melo (anselmolsm)
Modified: 2012-04-11 14:18 UTC (History)
21 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
valgrind output (884.04 KB, text/plain)
2012-03-27 21:17 UTC, Vincent de Phily
Details
valgrind output (695.80 KB, text/x-log)
2012-03-27 21:20 UTC, Vincent de Phily
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anselmo L. S. Melo (anselmolsm) 2012-02-13 16:08:31 UTC
Version:           unspecified (using KDE 4.8.0) 
OS:                Linux

I have 2 activities, both using the 'Desktop' template and both with the same plasmoids (LCD weather station, Network Monitor, CPU monitor, Memory Status, Hard disk status).
Every time I switch between activities, the private memory usage increases in about 15mb. This data was obtained via ksysguard, wich also indicates this memory increase happening in the [heap].

Reproducible: Always

Steps to Reproduce:
Create 2 activities, open ksysguard, filter by kactivitymanagerd then switch between activities.

Actual Results:  
The memory increases in every switch.
Happens here even without any application running.

Expected Results:  
memory usage should not increase like this

At this moment, ksysguard report says:
"The process kactivitymanagerd (with pid 770) is using approximately 5.3 GB of memory.
It is using 5.3 GB privately, 48.0 KB for pixmaps, and a further 12.5 MB that is, or could be, shared with other programs."

In library usage: heap is responsible for 5533444 KB. This number increases every activity switch.

I can provide more details/data if needed.
Another comment: A coworker tried to reproduce it in KDE SC 4.6
Comment 1 Anselmo L. S. Melo (anselmolsm) 2012-02-13 18:33:47 UTC
Missing information: using Qt 4.8.0
Comment 2 Olivier.jg 2012-02-15 07:58:07 UTC
Can also confirm this bug on Arch Linux.
After upgrading to KDE 4.8/Qt 4.8, kactivitymanagerd will leak on every activity change. I am forced to kill and restart it very often in order to free up the RAM.
Comment 3 Vincent de Phily 2012-02-15 13:11:40 UTC
Same problem here using Gentoo, 64bits. The leak I see is "just" 5.5MB.

It may be unrelated, but I have nepomuk disabled and see lots and lots of nepomuk-related error messages in kactivitymanagerd's output. Try disabling nepomuk and logging back in if you cannot reproduce. Do the other reporters have nepomuk disabled ?
Comment 4 Anselmo L. S. Melo (anselmolsm) 2012-02-15 13:49:07 UTC
(In reply to comment #3)
> Same problem here using Gentoo, 64bits. The leak I see is "just" 5.5MB.

Although my original report said "15MB", I noticed that this size is not uniform. Right after a kactivitymanagerd restart, the leak was smaller.
 
> Do the other reporters have nepomuk disabled ?

Nepomuk is disabled here too.
Comment 5 Olivier.jg 2012-02-16 00:01:36 UTC
Yes, Nepomuk is disabled on my machine.
Comment 6 parcours.lingual 2012-02-21 23:43:08 UTC
My kactivitymangerd goes up to 10% of my 2 GB RAM in one day, i think. I still have to do some tests. Nepomuk is disable. I have 5 activities.
I have KDE 4.8, Archlinux.
Comment 7 honkir 2012-02-27 11:28:35 UTC
Same for me, having Kubuntu, KDE 4.8.0, Nepomuk is off. Currently, kactivitymanager consumes 781M resident memory, 3G is my computer's RAM size.
Comment 8 Jiajun Wang 2012-02-27 13:30:36 UTC
*** Bug 294926 has been marked as a duplicate of this bug. ***
Comment 9 Koen 2012-02-27 17:17:12 UTC
Me too, opensuse 11.4, 64bit, kde 4.8.
Mine reached 1.7GB after a day of work ... .
QT 4.8.0
Comment 10 Risto H. Kurppa 2012-03-08 13:20:52 UTC
Kubuntu 11.10 witn KDE 4.8 and same here.

Someone please tell me how to restart kactivityd to reset the RAM comsumption without booting my system?
Comment 11 Anselmo L. S. Melo (anselmolsm) 2012-03-08 13:29:57 UTC
(In reply to comment #10)
> Someone please tell me how to restart kactivityd to reset the RAM
> comsumption without booting my system?

One possible way: Open KRunner (alt+F2) then write: kquitapp kactivitymanagerd + enter. Then use krunner again to run kactivitymanagerd.

Or you can the following on konsole: kquitapp kactivitymanagerd && kactivitymanagerd
Comment 12 sbordenave 2012-03-12 20:06:03 UTC
Can confirm this on arch, kde 4.8, nepomuk disabled
Comment 13 Björn Ruberg 2012-03-16 17:11:23 UTC
Have the problem with the Fedora 16 packages for KDE 4.8.1.
I cannot say that it leaks 15 Megabyte per switch - but it leaks. I usually restart kactivitymanagerd after using 400 Mb of RAM. This is really not good.
Comment 14 Anselmo L. S. Melo (anselmolsm) 2012-03-16 17:40:44 UTC
(In reply to comment #13)
> Have the problem with the Fedora 16 packages for KDE 4.8.1.
> I cannot say that it leaks 15 Megabyte per switch - but it leaks. I usually
> restart kactivitymanagerd after using 400 Mb of RAM. This is really not good.

Thanks for updating the report title =)
As I said in comment #4, the amount of memory leak is not constant as I had thought when I reported.
Comment 15 Ivan Čukić 2012-03-21 18:40:31 UTC
Is everyone here using it with nepomuk disabled? Does it still leak when Nepomuk is enabled?

The problem is that the version in master is mostly a rewrite of a big chunk of kamd in 4.8, so I can't say whether it got fixed unless I get the as specific explanation as possible of how to reproduce.
Comment 16 Björn Ruberg 2012-03-21 19:10:12 UTC
I activated nepomuk, logged off and logged in again. Now kactivitymanagerd does not leak anymore. It constantly uses 4268 Kb of RAM.
Comment 17 Adrián Chaves (Gallaecio) 2012-03-22 09:22:27 UTC
Chakra, KDE SC 4.8.1, and Nepomuk disabled. It is just ~4MiB each switch, although I noticed when it reached 1200MiB. High usage of activities, and not much reboot (virtual machine, usually saving the state).

Will enable Nepomuk and try to confirm if that solves the issue, although it seems it has already been verified.
Comment 18 Adrián Chaves (Gallaecio) 2012-03-22 09:28:31 UTC
Confirmed. You disable Nepomuk to save memory, and… Is this a punishment by the Nepomuk guys? :)
Comment 19 Moritz Augustin 2012-03-22 09:42:54 UTC
Arch packages, KDE 4.8.1, Nepomuk disabled.
The memory leak problem is still not fixed. Depending on the activity (I have 5 different ones) a change between activities will consume additional 10-20 MB of memory. Since I am never rebooting, but only  suspend to memory, this means now I have 4000 of 8000 MB used by kactivitymanagerd due to many activity changes.
Comment 20 Ivan Čukić 2012-03-22 09:59:00 UTC
@Adrian
Hah, that would be cool :)

Ok, now the hunting begins.
Comment 21 Olivier.jg 2012-03-22 12:16:06 UTC
In "kde settings > Startup and shutdown > service manager > startup services" I enabled "Nepomuk search module". This did not stop the leak.
I realized there is another setting in the Desktop Search module which I had also disabled. I've yielded to the Nepomuk developers' evil plan and enabled it. kactivitymanagerd has accepted my surrender and ceased its attack.
Comment 22 Ivan Čukić 2012-03-25 19:41:05 UTC
Anyone here 32bit? Can't seem to reproduce the issue so far under VMs.
Comment 23 Ivan Čukić 2012-03-25 20:21:21 UTC
p.s. Anyone able to run kamd in valgrind?
(http://www.cprogramming.com/debugging/valgrind.html)
Comment 24 Ivan Čukić 2012-03-26 19:47:57 UTC
Ok, since I am still unable to reproduce the bug, I've made some changes that could possibly help. Those should be in 4.8.2 (scheduled this week).
Comment 25 Koen 2012-03-26 19:50:35 UTC
Turning on Nepomuk helped, tnx.
Comment 26 Adrián Chaves (Gallaecio) 2012-03-27 06:03:32 UTC
IIRC, my VM at work is 32-bit, while the one at home i 64-bit. I am affected on both.
Comment 27 Will Stephenson 2012-03-27 08:06:47 UTC
I can confirm that it leaks like a sieve in 4.8.1 with Nepomuk enabled.  I have alt+` bound as a keyboard shortcut to Next Activity, just pop up ksysguard and hold down the shortcut to see kactivitymanagerd inflate.
Comment 28 Olivier.jg 2012-03-27 08:15:05 UTC
(In reply to comment #27)
> I can confirm that it leaks like a sieve in 4.8.1 with Nepomuk enabled...
Enabled or disabled?
Comment 29 Björn Ruberg 2012-03-27 08:18:06 UTC
I have changed the default key shortcut for "next activity" too - maybe that triggers the problem (when having nepomuk disabled)?
Comment 30 Ivan Čukić 2012-03-27 12:19:39 UTC
Now tested even Fedora 16, kde sc 4.8.1

The only thing I managed to achieve is when I keep the /next activity/ key pressed, to raise the memory to 10k, but as soon as I stop switching, it goes back to 6.7k.

For now (if I don't replicate the issue until tomorrow), lets hope the changes I pushed yesterday will fix this and the .xsession-errors flooding bug.
Comment 31 Vincent de Phily 2012-03-27 21:17:22 UTC
Created attachment 69948 [details]
valgrind output

Sorry, should have realized earlyer that you had trouble reproducing. As a thanks for the time spent so far, here's the log of "valgrind --leak-check=full -- kactivitymanagerd --nofork 2> valgrind.log" after switching activities many times.
Comment 32 Vincent de Phily 2012-03-27 21:20:02 UTC
Created attachment 69949 [details]
valgrind output

And another one, this time switching activities only once before ^C-ing.

Both traces were aquired under Gentoo 64bits.
Comment 33 Alessandro Buggin 2012-04-01 13:04:51 UTC
http://paste.kde.org/450098/
The process kactivitymanagerd (with pid 5080) is using approximately 1.2 GB of memory.
Full Details provided.
Hope it helps
Comment 34 alphsteiner 2012-04-07 17:31:04 UTC
Same for me (fedora 16, nepomuck disabled).
I have also noticed that dbus-daemon use more cpu than usual after a lot of leaks,
and return to normal after a stop & restart of kactivitymanagerd.
Can someone confirm this ?
Comment 35 Vincent de Phily 2012-04-07 22:11:12 UTC
This is now fixed for me, using KDE SC 4.8.2 for a few days, same setup, switching activities a lot.
Comment 36 Anselmo L. S. Melo (anselmolsm) 2012-04-07 23:01:03 UTC
I updated to KDE SC 4.8.2 too, this issue seems fixed. I can not reproduce the memory increase anymore (nepomuk disabled here).
Comment 37 Ivan Čukić 2012-04-09 09:21:16 UTC
Can a few more people confirm whether it is fixed in 4.8.2 so that I can close the report?
Comment 38 Adrián Chaves (Gallaecio) 2012-04-09 11:10:08 UTC
I’ve just disabled Nepomuk, opened a second activity (had only one open), switched between the two several times, and the memory was the same.
Comment 39 Vincent de Phily 2012-04-11 13:39:58 UTC
(In reply to comment #38)
> I’ve just disabled Nepomuk, opened a second activity (had only one open),
> switched between the two several times, and the memory was the same.

Since we can't be sure wether you were affected by the bug before, that's not a definite proof that the bug is gone (even though in my experience, it is).
Comment 40 honkir 2012-04-11 13:58:02 UTC
Fixed for me. Before first activity switch, kactivitymanager tiik about 4MB RAM, after the first switch using activity switching dialog 6.5MB and the ram usage remained on this level while switching back and while playing with activities in various ways. Thanks.
Comment 41 Ivan Čukić 2012-04-11 14:18:10 UTC
@Vincent True, but with that reasoning we can't have the proof that the bug existed :)

Anyhow, the way KAMD accesses nepomuk has changed drastically, and since it seems to be fixed in 4.8.2, I'm closing the report.