Caffeine uses huge amounts of memory over time, possible memory leak

Bug #460124 reported by DenisP
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Caffeine
Fix Released
Critical
pragmattica

Bug Description

Caffeines memory usage grows over time. In some 10 Hours it grows over 100 MB and is still growing after that.
I use caffeine Version 1.0, all settings are switched off and process monitoring list is empty on Ubuntu 9.04. It seems that this problem is connected somehow with new features that are built in since version 1.0 because I have not noticed such memory usage growth in prior versions of caffeine.
This is problem for me because I am using hibernation to turn off my laptop so that caffeines memory usage grows extensively over time and after some time I must restart caffeine to reset its memory usage which is annoying.

Revision history for this message
pragmattica (bnsmith) wrote :

My "caffeine" process is at 143 MB right now. That definitely seems too high. Will begin investigating.

Changed in caffeine:
importance: Undecided → Critical
status: New → Confirmed
Changed in caffeine:
milestone: none → 1.0.1
Revision history for this message
pragmattica (bnsmith) wrote :

I'm not positive, but I think that disabling the QuakeLive function reduces the amount of memory that is eaten up over time. It seems that memory may still be leaking when this feature is disabled, but the leak may be slower.

Revision history for this message
Tommy Brunn (tommybrunn) wrote :

I have the Quake Live function off, and I still have this issue.

Revision history for this message
DenisP (denisp) wrote :

I have done some tests myself, so here is my report.

I have commented out the line gobject.timeout_add(5000, self.update_recent_liststore) on the line 138 in the file main.py in class ProcAdd in method __Init__ and line self.running_id = gobject.timeout_add(5000, self.update_running_liststore) on the line 245 in the same file and in the same class in methode run.

After I have done that I don't have any rising memory usage over the time if I don't activate Flash or Quake Live functions.
If I activate Flash function alone it seems that there is not rising memory usage over time or it is very small.
If I activate Quake Live function alone I have small rising of memory usage over time.

So for me it seems that major part of the memory leak is caused somewhere in the code which is handling running process detection. Perhaps that part which is periodically updating list of running processes because I think these lines I have commented out are periodically updating lists of running processes.

I hope this can help to solve the problem.

Revision history for this message
pragmattica (bnsmith) wrote :

I've come to the same conclusion. There is a fix committed that helps with QuakeLive detection (I think). And I also recently discovered the connection to the "update_running_*" functions (I could have saved myself some time if I had checked this bug first). In fact, I think that there is a connection to the utils.getProcesses function, but I haven't completely figured it out. I'm going to keep working on it. Thanks for your help!

Changed in caffeine:
assignee: nobody → pragmattica (bnsmith)
Revision history for this message
pragmattica (bnsmith) wrote :

I now think that this leak is related to icons, and occurs in the GTK extension rather than within Python. If I comment out most of the "get_icon_for_process" function, leaving only "return None" at the end, there doesn't seem to be any more leaking. It seems like every icon we load is stored in memory; none are released. Hence the leak.

Revision history for this message
pragmattica (bnsmith) wrote :

I tested this for a little more than 8 hours, and the memory leak is dramatically improved. I've decided to mark this bug as closed, as the leak is small enough to no longer be critical. I estimate that Caffeine will leak approximately 3-4 MB of memory for each 24 hour period that it runs. I will open another bug for that leak, and I have some ideas already on how to fix it.

Changed in caffeine:
status: Confirmed → Fix Committed
pragmattica (bnsmith)
Changed in caffeine:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.