Sunday, September 06, 2009

KDE 4 memory leak

For the last month or so my Kubuntu Linux box has been plagued by a particular problem: after running for a little while it would gradually become more and more unresponsive, to the point of unusability. I'm running Jaunty Jackalope on a pretty quick Intel chip, with 2 GB of memory. I've got a 256 MB NVidia video card to boot -- one previously purchased by youngest son (the gamer).

I'd walk away from my desktop and find when I came back it was stuck in molasses. Clicking on a button would do .... nothing. I'd have to hold the mouse button down and wait.  And wait.  And wait.

Usually I've found this sort of weirdness can be explained by overheating, but that didn't seem to be the case here. Couple that with the fact that I didn't see the problem when running another window manager and signs pointed to an issue with KDE 4.

After suffering through this for a while, I discussed the situation with clever youngest son (now a freshman computer science / information technology major at George Mason University) and he said it sounded like a memory leak.

Lo and behold, after some intensive research on line, I ran across several posts that discussed the fact that indeed, if certain desktop effects are enabled, there is a nasty memory leak in Kwin. The following posts reference it here and here. It's not just Linux that's affected: apparently FreeBSD has the same problem with KDE 4.

I'm a simple man: I'm looking for a simple fix.

Finally, I found this thread over at the Fedora forum.

To summarize, the problem is with compositing in Kwin. The easy way of dealing with it it to disable it. Rather than going in and screwing with all of my settings on the GUI, I jumped down to the command line and edited my config file for Kwin.

Drop to a shell and, from your home directory, go to the following directory:

     .kde/share/config/

Make a  backup (always make a backup!) of kwinrc

Find the section that says:

    [Compositing]
    Enabled=true
Change it to:
    [Compositing]
    Enabled=false

Save your changes. For this to take effect, you'll need to log out and restart your session so that Kwin has restarted. It is not necessary to reboot.

I did this and have had no more problems with my machine becoming unresponsive. Of course, I probably gave up some bit of window manager eye candy, but to be honest, eye candy is the functional equivalent of junk food. The alternative would be to switch to Gnome (gasp) or some other window manager, and I have to admit, even with all it's flaws, I'm a KDE man (although IceWM is not a bad light weight window manager).

Presumably this will be corrected at some point, although to read the forums, there is not universal agreement over exactly who is responsible for the problem. Thanks to StoneDragon at the Fedora Forums for this straight forward fix.

As always, your mileage may vary.

No comments:

ShareThis