Memory leak in dbus / dbus-c++ ?

Olivier Hochreutiner olivier.hochreutiner at gmail.com
Tue Jul 31 15:46:12 EEST 2007


Hi,

After experimenting some more dbus with the dbus-c++ binding, it
turned out that there is a memory leak.

It can be easily reproduced with the echo-client/echo-server example
of dbus-c++. The amount of memory used by echo-client linearly
increases. I tested only under Windows, but I have no reason to think
it does not happen under Linux. Anyway it's very easy to reproduce.

I used BoundChecker to detect where the memory that is not freed in
allocated. It reports three places in the code (see attached file). I
investigated the problem a bit and it seems that reply messages are
not freed ?

Thanks,

Olivier
-------------- next part --------------
Function					File			Line
------------------------------------------------------------------------------------
dbus_malloc					dbus-memory.c		471
dbus_message_new_empty_header			dbus-message.c		966
_dbus_message_loader_queue_messages		dbus-message.c		3617
_dbus_transport_get_dispatch_status		dbus-transport.c	1066
_dbus_transport_queue_messages			dbus-transport.c	1093
do_reading					dbus-transport-socket.c	783
socket_do_iteration				dbus-transport-socket.c	1078
_dbus_transport_do_iteration			dbus-transport.c	943
_dbus_connection_do_iteration_unlocked		dbus-connection.c	1144
_dbus_connection_block_pending_call		dbus-connection.c	2270
dbus_pending_call_block				dbus-pending-call.c	707
dbus_connection_send_with_reply_and_block	dbus-connection.c	3269
Connection::send_blocking			connection.cpp		349
ObjectProxy::_invoke_method			object.cpp		318
InterfaceProxy::invoke_method			interface.cpp		147
freedesktop::DBus::EchoDemo::Hello		echo-client-win-glue.h	50
main						echo-client-win.cpp	31

Function					File			Line
------------------------------------------------------------------------------------
dbus_malloc					dbus-memory.c		471
_dbus_string_init_preallocated			dbus-string.c		148
dbus_message_new_empty_header			dbus-message.c		1000
_dbus_message_loader_queue_messages		dbus-message.c		3617
_dbus_transport_get_dispatch_status		dbus-transport.c	1066
_dbus_transport_queue_messages			dbus-transport.c	1093
do_reading					dbus-transport-socket.c	783
socket_do_iteration				dbus-transport-socket.c	1078
_dbus_transport_do_iteration			dbus-transport.c	943
_dbus_connection_do_iteration_unlocked		dbus-connection.c	1144
_dbus_connection_block_pending_call		dbus-connection.c	2270
dbus_pending_call_block				dbus-pending-call.c	707
dbus_connection_send_with_reply_and_block	dbus-connection.c	3269
Connection::send_blocking			connection.cpp		349
ObjectProxy::_invoke_method			object.cpp		318
InterfaceProxy::invoke_method			interface.cpp		147
freedesktop::DBus::EchoDemo::Hello		echo-client-win-glue.h	50
main						echo-client-win.cpp	31


Function					File			Line
------------------------------------------------------------------------------------
dbus_realloc					dbus-memory.c		601
reallocate_for_length				dbus-string.c		353
set_length					dbus-string.c		374
open_gap					dbus-string.c		395
copy						dbus-string.c		1405
_dbus_string_copy_len				dbus-string.c		1580
_dbus_header_load				dbus-marshal-header.c	974
load_message					dbus-message.c		3482
_dbus_message_loader_queue_messages		dbus-message.c		3623
_dbus_transport_get_dispatch_status		dbus-transport.c	1066
_dbus_transport_queue_messages			dbus-transport.c	1093
do_reading					dbus-transport-socket.c	783
socket_do_iteration				dbus-transport-socket.c	1078
_dbus_transport_do_iteration			dbus-transport.c	943
_dbus_connection_do_iteration_unlocked		dbus-connection.c	1144
_dbus_connection_block_pending_call		dbus-connection.c	2270
dbus_pending_call_block				dbus-pending-call.c	707
dbus_connection_send_with_reply_and_block	dbus-connection.c	3269
Connection::send_blocking			connection.cpp		349
ObjectProxy::_invoke_method			object.cpp		318
InterfaceProxy::invoke_method			interface.cpp		147
freedesktop::DBus::EchoDemo::Hello		echo-client-win-glue.h	50
main						echo-client-win.cpp	31


More information about the dbus mailing list