Memory leak in dbus / dbus-c++ ?
olivier.hochreutiner at gmail.com
Tue Jul 31 08:56:50 PDT 2007
> > DBusMessage memory blocks are recycled for reuse internally. That
> > shouldn't count as memory leaks, because there are still pointers to the
> > blocks.
> > However, they would be memory leaks if the binding doesn't properly call
> > dbus_message_unref.
> The way to tell the difference is, does memory continuously rise or just
> rise to a certain point?
It rises continuously.
> Olivier, the leak is probably not in libdbus because the test suite
> pretty extensively checks for leaks. Of course it doesn't 100%
> comprehensively check, so a bug is still possible.
> I would look in the bindings first though for a missing unref.
I checked that and it seems fine. Actually I remarked that
dbus_connection_send_with_reply_and_block() returns a DBusMessage with
refcount == 1, and the c++ binding calls dbus_message_ref() on it, and
then later dbus_message_unref(), which means refcount is still 1 at
the end and the message is not freed.
I also remarked that the reply message returned by
dbus_connection_send_with_reply_and_block() is also passed to the
dispatcher. Is this expected ? It seems to me that this is not
correct, since it's the reply to a known method call, so dispatching
is not needed, or am I wrong ?
Anyway an input from Paolo is also welcome :)
More information about the dbus