After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 566962 - gnome-system monitor leaks
gnome-system monitor leaks
Status: RESOLVED FIXED
Product: system-monitor
Classification: Core
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: System-monitor maintainers
System-monitor maintainers
Depends on:
Blocks:
 
 
Reported: 2009-01-07 23:41 UTC by Hubert Figuiere (:hub)
Modified: 2011-11-11 10:03 UTC
See Also:
GNOME target: ---
GNOME version: 2.23/2.24


Attachments
patch to fix the issue (1.32 KB, patch)
2009-01-07 23:43 UTC, Hubert Figuiere (:hub)
reviewed Details | Review
new patch (2.41 KB, patch)
2009-01-08 05:25 UTC, Hubert Figuiere (:hub)
committed Details | Review

Description Hubert Figuiere (:hub) 2009-01-07 23:41:23 UTC
gnome-system monitor leaks


Attached is a patch to fix that. Let me know if I can commit it to trunk and/or the branch.
Comment 1 Hubert Figuiere (:hub) 2009-01-07 23:43:09 UTC
Created attachment 125987 [details] [review]
patch to fix the issue

Here is the patch that fix the issue. 

I was thinking of changing procman::format_size() to return a std::string but decided of the less invasive change in this patch.
Comment 2 Benoît Dejean 2009-01-08 00:50:16 UTC
Hello Hub,

I see no leak in proctable.cpp because:
- p is an iterator to a map<uid, char*>
- this->user is a shared char* to that map's keys
- when the uid is not in the map, it is duped (because getpwuid uses static memory) and inserted into the map.

So maybe valgrind complains about some bits not being cleaned at exit, but i don't think there's a leak. 

But the other bit is totally valid. I'm going to commit it to both gnome-2-24 and trunk.

Merci.
Comment 3 Hubert Figuiere (:hub) 2009-01-08 05:25:56 UTC
Created attachment 126001 [details] [review]
new patch

ok this is a rework of the patch. I actually change the UserMap value_type to std::string. This is way safer on every aspect. (I initially thought it was like that).
Comment 4 Kjartan Maraas 2009-01-08 19:05:38 UTC
You probably don't want to add anything but glib.h these days since the single includes are going away.
Comment 5 Hubert Figuiere (:hub) 2009-01-08 19:19:27 UTC
good point. I was just following what was done elsewhere in g-s-m.
Comment 6 Benoît Dejean 2009-01-08 21:25:17 UTC
I've commited the leak plug to gnome-2-24 : http://svn.gnome.org/viewvc/gnome-system-monitor?view=revision&revision=2545 .
Comment 7 Hubert Figuiere (:hub) 2009-04-18 20:26:25 UTC
will attache a new version of the patch for what is left.
Comment 8 Hubert Figuiere (:hub) 2009-04-18 20:31:59 UTC
actually commit and pushed to master with Benoit approval.