On Wed, May 02, 2012 at 09:00:35PM -0600, Alan Robertson wrote:
> This is very interesting. My apologies for missing this memory leak
> :-(. The code logs memory usage periodically exactly to help notice
> such a thing.
>
> In my new open source project [http://assimmon.org], I am death on
> memory leaks. But I can assure you that back when that code was
> written, it was not at all clear who deleted what memory when - when it
> came to the glib. I'm not sure if valgrind was out back then, but I
> certainly didn't know about it.
>
> I confess that even on this new project I had a heck of a time making
> all the glib objects go away. I finally got them cleaned up - but it
> took weeks of running under valgrind before I worked out when to do what
> to make it throw the objects away - but not crash due to a bad reference.
>
> By the way, I suspect Lars' suggestion would work fine. I would
> certainly explain what the "better" patch is in the comments when you
> apply this one.
My suggestion would be:
diff --git a/lib/clplumbing/GSource.c b/lib/clplumbing/GSource.c
--- a/lib/clplumbing/GSource.c
+++ b/lib/clplumbing/GSource.c
@@ -1506,6 +1506,7 @@ Gmain_timeout_add_full(gint priority
g_source_set_callback(source, function, data, notify);
append->gsourceid = g_source_attach(source, NULL);
+ g_source_unref(source);
return append->gsourceid;
}
Then recompile and reinstall libglue.
Please see if that also fixes the leak for you
(and does not explode).
Note: that is *instead* of your patch,
not in addition to.
Thanks,
Lars
--
: Lars Ellenberg
: LINBIT | Your Way to High Availability
: DRBD/HA support and consulting http://www.linbit.com
DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/