! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
cpugraph leaks memory
Status:
RESOLVED: FIXED
Product:
Xfce4-cpugraph-plugin
Component:
General

Comments

Description arne hoch 2006-08-09 09:29:13 CEST
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; de; rv:1.8.0.5) Gecko/20060719 Firefox/1.5.0.5
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.8.0.5) Gecko/20060719 Firefox/1.5.0.5

When running for a longer time, one day or so, cpugraph is using about 35mb of memory.
The following fixed it for me:

--- cpu.c.old   2006-08-09 11:02:40.446805504 +0200
+++ cpu.c       2006-08-09 01:26:29.950955461 +0200
@@ -244,7 +244,7 @@
 void
 UpdateTooltip (CPUGraph * base)
 {
-    char tooltip[32];
+    static char tooltip[32];
 
     sprintf (tooltip, "Usage: %ld%%", base->m_CPUUsage);
     gtk_tooltips_set_tip (GTK_TOOLTIPS (base->m_Tooltip),


Reproducible: Always

Steps to Reproduce:
Comment 1 Nick Schermer editbugs 2006-08-09 09:46:00 CEST
It's better to free the tooltip:

void
UpdateTooltip (CPUGraph * base)
{
    gchar *tooltip;

    tooltip = g_strdup_printf ("Usage: %ld%%", base->m_CPUUsage);
    gtk_tooltips_set_tip (GTK_TOOLTIPS (base->m_Tooltip), 
                          base->m_FrameWidget->parent, tooltip, NULL);
    g_free (tooltip);
}

Maybe "char tooltip[32]" > "const char tooltip[32]" will also work.
Comment 2 Benedikt Meurer editbugs 2006-08-09 14:27:34 CEST
Ehm, that's definitely not the cause of a memory leak.
Comment 3 arne hoch 2006-08-10 08:49:34 CEST
ok, you're right.
the problem only appears when using LED-mode. everything is fine in normal mode.
Comment 4 Jean-François Wauthy editbugs 2006-08-12 09:45:06 CEST
the DrawGraph function doesn't unref all the GdkGC it can create maybe it could be the cause of such memleak
Comment 5 Jasper Huijsmans editbugs 2006-08-16 11:50:50 CEST
Created attachment 740 
Free gc's

In two modes a gc isn't freed after use. This was the only obvious memory leak I could find, but I didn't look very thoroughly.
Comment 6 Jasper Huijsmans editbugs 2006-08-16 13:41:29 CEST
Ok, I committed the changes with revision 1906. It would be helpful if you could test the patch or update from SVN.
Comment 7 arne hoch 2006-08-18 13:29:38 CEST
the patch did it for me
Comment 8 Jasper Huijsmans editbugs 2006-12-09 11:06:50 CET
Fixed according to the comments, so I'm closing this report.

Bug #2141

Reported by:
arne hoch
Reported on: 2006-08-09
Last modified on: 2010-10-03

People

Assignee:
Florian Rivoal
CC List:
0 users

Version

Version:
0.3.0 or older
Target Milestone:
0.4.0 or older

Attachments

Free gc's (656 bytes, patch)
2006-08-16 11:50 CEST , Jasper Huijsmans
no flags

Additional information