[dash] memory usage increases slowly - memory leak?

Bug #723956 reported by Andrew Hayzen on 2011-02-23
46
This bug affects 6 people
Affects Status Importance Assigned to Milestone
unity-2d
Critical
Florian Boucault
qt4-x11 (Ubuntu)
Undecided
Unassigned
Natty
Undecided
Unassigned
Oneiric
Undecided
Unassigned
unity-2d (Ubuntu)
Undecided
Unassigned
Natty
Undecided
Unassigned
Oneiric
Undecided
Unassigned

Bug Description

Hi

unity-2d:
  Installed: 0.4-0ubuntu1~bzr405
  Candidate: 0.4-0ubuntu1~bzr405
  Version table:
 *** 0.4-0ubuntu1~bzr405 0
        500 http://ppa.launchpad.net/unity-2d-team/unity-2d-daily/ubuntu/ maverick/main i386 Packages
        100 /var/lib/dpkg/status
Description: Ubuntu 10.10
Release: 10.10

What happened:
I was running the PC as normal but it suddenly be very slow at doing anything. When watching the RAM usage from the system monitor I noticed that unity-2d-places had a RAM usage of ~140Mb.
Then found out that when I show and then hide the dash that the RAM usage would slowly.

What should happen:
unity-2d-places should not use extortionate amounts of RAM.

Note: I have included a video showing the high memory usage and the memory usage increasing as you show and then hide the dash.

I hope that this bug can be fixed as it leaves the system feeling very slow and should remain at its normal usage of ~32Mb.

Andy

Related branches

Revision history for this message
Andrew Hayzen (ahayzen) wrote :
Andrew Hayzen (ahayzen) on 2011-02-23
description: updated
summary: - unity-2d-places memory usage increases slowly - memory leak?
+ [dash] memory usage increases slowly - memory leak?
Revision history for this message
Florian Boucault (fboucault) wrote :

Thanks for the report Andrew.

The information provided by GNOME system monitor is not representative enough as it does not show the amount of RSS memory used. You can try monitoring that parameter with 'ps aux' in a console.
Unfortunately I cannot reproduce that issue myself.

Out of curiosity, how much RAM do you have in total? We are trying to support 512MB but our strict target for Unity 2D is 1GB.

Changed in unity-2d:
status: New → Incomplete
Revision history for this message
Andrew Hayzen (ahayzen) wrote :

Hi Florian

I managed to reproduce the bug again, I thought I wouldn't be able to. I just opened and closed the dash and places loads of times and changed between the different sections and made sure that I scrolled up and down as well.

However this time I had terminal running with 'ps aux' another with 'top' and the system monitor with some more columns enabled. I have attached a screen shot so you can see. Note that unity-2d-places is at the top of the terminal for 'ps aux'.

The RSS value was: 199904.

Also you said you wanted to know how much RAM I have well I currently have 1Gb of RAM installed and 3.8Gb of SWAP.

Furthermore I noted that the RAM usage does increase even further when you search but I see that that bug has already been reported. On the other hand this one seems different as it seems to slowly increase just from show and hiding the dash/places and then changing sections or scrolling. Could it be something to do with the caching of images or something and it not clearing the cache?
Because over a period of time the RAM usage does slowly reduce back (however this doesn't seem to happen once you have gone above ~100Mb). If you watch the RAM from start up it jumps from ~30Mb to ~50Mb then it slowly drops back. However once it goes above 100Mb it doesn't seem to be released back to the OS.

Hope that helps.

Andy

Changed in unity-2d:
status: Incomplete → New
status: New → Opinion
importance: Undecided → High
status: Opinion → New
Revision history for this message
Andrew Hayzen (ahayzen) wrote :

Hi Florian

I have been trying to work out what is causing this issue but still haven't had any more ideas than before. However I have been running unity-2d-places in terminal and I have collected the errors that come up when I bring up the applications menu.

If it is any use to you I have posted some of the errors below (from just clicking on applications), however most of them seem to just be the same issue of there being no icon found and GTK complaining that the icon is null - unless this is the issue?

Output from terminal:
(<unknown>:5219): Gtk-CRITICAL **: IA__gtk_icon_info_load_icon: assertion `icon_info != NULL' failed

(<unknown>:5219): Gtk-CRITICAL **: IA__gtk_icon_info_load_icon: assertion `icon_info != NULL' failed

(<unknown>:5219): Gtk-CRITICAL **: IA__gtk_icon_info_load_icon: assertion `icon_info != NULL' failed
Unity 2D Dash: [WARNING] file:///usr/share/unity-2d/places/UnityDefaultRenderer.qml:19:13: QML QDeclarativeImage_QML_24: Failed to get image from provider: image://icons/akonadi
Unity 2D Dash: [WARNING] file:///usr/share/unity-2d/places/UnityDefaultRenderer.qml:19:13: QML QDeclarativeImage_QML_24: Failed to get image from provider: image://icons//usr/share/pixmaps/assaultcube.png
Unity 2D Dash: [WARNING] file:///usr/share/unity-2d/places/UnityDefaultRenderer.qml:19:13: QML QDeclarativeImage_QML_24: Failed to get image from provider: image://icons/dosbox
Unity 2D Dash: [WARNING] file:///usr/share/unity-2d/places/UnityDefaultRenderer.qml:19:13: QML QDeclarativeImage_QML_24: Failed to get image from provider: image://icons/emerillon
Unity 2D Dash: [WARNING] file:///usr/share/unity-2d/places/UnityDefaultRenderer.qml:19:13: QML QDeclarativeImage_QML_24: Failed to get image from provider: image://icons//usr/share/pixmaps/hexter.xpm
Unity 2D Dash: [WARNING] file:///usr/share/unity-2d/places/UnityDefaultRenderer.qml:19:13: QML QDeclarativeImage_QML_24: Failed to get image from provider: image://icons/kexi
Unity 2D Dash: [WARNING] file:///usr/share/unity-2d/places/UnityDefaultRenderer.qml:19:13: QML QDeclarativeImage_QML_24: Failed to get image from provider: image://icons/lv2rack32x32

Also from the latest update of unity-2d I noted much faster browsing of the places (good work guys).

Furthermore when watching the RAM usage it can dramatically increase just by bringing up the places menu, usually around 10 Mb Memory, 10 MB Resident Memory and 10 Mb Virtual memory.

If there are any other logs I can access or commands I can run to help debug this issue please post here and I will try them out.

Hope that helps.

Andy

Changed in unity-2d:
milestone: none → 3.10
Bill Filler (bfiller) on 2011-03-29
Changed in unity-2d:
importance: High → Critical
assignee: nobody → Aurélien Gâteau (agateau)
Changed in unity-2d:
milestone: 3.10 → 3.8.2
Muhammad Nabil (ghogaru) on 2011-03-30
Changed in unity-2d:
assignee: Aurélien Gâteau (agateau) → Muhammad Nabil (ghogaru)
status: New → Confirmed
Changed in unity-2d:
status: Confirmed → New
assignee: Muhammad Nabil (ghogaru) → Aurélien Gâteau (agateau)
Revision history for this message
Chris (fabricator4) wrote :

I can recreate this at will. Open applications and do a search (eg for "startup"). The RAM usage in Unity 2d will climb about 5Mb. start the appliation and it will often climb another 3mb or more.

Now open applications and search for another app (eg firefox) and watch the RAM usage climb again. You don't even need to open the app, backspace and search for "startup" again. Keep doing this and the RAM usage climbs again and again. Sometimes it plateaus, if this happens, just open the app, and the ram climbs again and so on. I was able to get the unity ram usage up very high very quickly. I stopped with it got silly - over 512 Mb ram usage for Unity 2D. I've been watching my RAM for a while now wondering were it was going.

I'm also going to raise a bug on Firefox beta 4 - 200Mb is ridiculous, also where my RAM was going. I have a 1 GB machine.

I'm attaching a screen shot for demonstration purposes, note the ram usage figure in system monitor for Unity.

Regards,
Chris Robinson

Revision history for this message
Chris (fabricator4) wrote :

For now, the workaround to get the RAM back seems to be to select the Unity-2d-places module in system monitor under processes and end it. I noticed that 2D places wasn't running at startup, and thought it might not cause any huge problems if it was ended this way. It does release the memory again once the process is ended.

Chris

Revision history for this message
Chris (fabricator4) wrote :

Further to this, lucazade over on ubuntuforums.org has said that he can't recreate this problem, running Unity 2D from the PPA. I've got two machines here that will recreate the problem easily, and they both have Unity 2D installed from the repository, on a fresh install from the 11.04 beta LiveCD.

Chris.

Revision history for this message
Aurélien Gâteau (agateau) wrote :

I have been trying to track the reason behind the leak. The leak is indeed much more important when one opens the application places. I think it is caused by QML grid view not releasing grid items. I came to this conclusion by running unity-2d-places under Valgrind, with a debug-build of Qt. The two attached log files were created by running valgrind with the following options:

valgrind --leak-check=full \
    --undef-value-errors=no \
    --partial-loads-ok=yes \
    --show-reachable=yes \

unity-2d-places-valgrind-normal.log is the log for current trunk

unity-2d-places-valgrind-rough.log is the log after having heavily hacked the result grid down to something really rough and ugly: only ListView and TextCustom QML items (I pushed it on lp:~agateau/unity-2d/xp-dash-leak, but be warned it is unusable: items overlap each others)

Both logs where created with the same steps:
- Open application place
- Type q
- Erase it
- Type w
- Erase it
- Close the dash

The second log shows a lot less leaks, but what worries me is that both show leaks coming from Qt Declarative allocating memory itself, so I am not sure how to address this.

Revision history for this message
Aurélien Gâteau (agateau) wrote :
Revision history for this message
Aurélien Gâteau (agateau) wrote :
Changed in unity-2d:
milestone: 3.8.2 → 3.10
Changed in unity-2d:
milestone: 3.10 → 3.8.4
Revision history for this message
Florian Boucault (fboucault) wrote :

After much trial and error I managed to isolate the leak to a separate, simple QML program.

Changed in unity-2d:
status: New → Confirmed
Revision history for this message
Florian Boucault (fboucault) wrote :

After investigating Qt's code it turns out that the likely culprit is QDeclarativeVisualItemModel for not always freeing the delegates.

Adding the following code to src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp at line 999 fixes the leak:

QCoreApplication::sendPostedEvents(obj, QEvent::DeferredDelete);

Changed in unity-2d:
assignee: Aurélien Gâteau (agateau) → Florian Boucault (fboucault)
status: Confirmed → In Progress
Changed in unity-2d:
milestone: 3.8.4 → 3.10
Revision history for this message
Jonathan Riddell (jr) wrote :

debdiff for natty-proposed

tags: added: patch
Revision history for this message
Martin Pitt (pitti) wrote : Please test proposed package

Accepted qt4-x11 into natty-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in qt4-x11 (Ubuntu Natty):
status: New → Fix Committed
tags: added: verification-needed
Changed in unity-2d:
status: In Progress → Fix Committed
tags: added: verification-done
removed: verification-needed
Revision history for this message
Bartosz Kosiorek (gang65) wrote :

Verified. The patch fix memory leak. Now the memory increased from 40MB to 54MB and it is no increasing anymore

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package qt4-x11 - 4:4.7.2-0ubuntu6.1

---------------
qt4-x11 (4:4.7.2-0ubuntu6.1) natty-proposed; urgency=low

  * Add kubuntu_92_qml_memory_leak.diff from Canonical Design team to
    fix a memory leak in QML, LP: #723956
 -- Jonathan Riddell <email address hidden> Tue, 26 Apr 2011 17:07:09 +0100

Changed in qt4-x11 (Ubuntu Natty):
status: Fix Committed → Fix Released
Revision history for this message
Thorbjørn Lindeijer (thorbjorn) wrote :

Has an upstream bug report been opened for this issue?

Revision history for this message
Florian Boucault (fboucault) wrote :

Thanks for asking the question Thorbjørn. Here is the upstream bug: http://bugreports.qt.nokia.com/browse/QTBUG-19469

Didier Roche (didrocks) on 2011-05-31
Changed in unity-2d (Ubuntu Oneiric):
status: New → Fix Committed
Revision history for this message
Peter B. (puk007-gmail) wrote :

that's quite interesting as I've read the upstream bug report and it seems, like the solution provided here is not OK, but this one is anyway set to Fix Committed.
Is it OK like that? :)

Changed in unity-2d:
milestone: 3.10 → 3.8.6
Changed in unity-2d:
status: Fix Committed → Fix Released
Changed in unity-2d (Ubuntu Oneiric):
status: Fix Committed → Fix Released
Changed in unity-2d (Ubuntu Natty):
status: New → Fix Released
Changed in qt4-x11 (Ubuntu Oneiric):
status: New → Confirmed
Omer Akram (om26er) on 2011-09-06
Changed in qt4-x11 (Ubuntu Oneiric):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers