dbus valgrind check

Ernast Sevo ersevs at gmail.com
Fri Jun 14 07:57:24 PDT 2013


Hello,

I have the following code which I am running through valgrind:

                pthread_t DBusMainLoopThread;
                DBusError error;
		dbus_error_init(&error);
	
		dbus_threads_init_default();
		GMainLoop *loop = g_main_loop_new(NULL, TRUE);
		DBusConnection *conn = dbus_bus_get(DBUS_BUS_SYSTEM, &error);

		if (dbus_error_is_set(&error))
		{
		        // print error message
			dbus_error_free(&error);
		}

		dbus_connection_setup_with_g_main(conn, NULL);
                pthread_create(&DBusMainLoopThread, NULL, RunMainLoop,
loop);                 // RunMainLoop is just a method that calls
g_main_loop_run

                sleep(5);

                g_main_loop_quit(loop);
           	g_main_loop_unref(loop);
	        dbus_connection_unref(conn);


and I get the following results:

==316== HEAP SUMMARY:
==316==     in use at exit: 22,199 bytes in 132 blocks
==316==   total heap usage: 197 allocs, 65 frees, 27,693 bytes allocated
==316==
==316== 144 bytes in 1 blocks are possibly lost in loss record 1 of 6
==316==    at 0x4833ACC: calloc (in
/usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==316==
==316== 3,256 bytes in 9 blocks are possibly lost in loss record 3 of 6
==316==    at 0x4833920: memalign (in
/usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==316==
==316== LEAK SUMMARY:
==316==    definitely lost: 0 bytes in 0 blocks
==316==    indirectly lost: 0 bytes in 0 blocks
==316==      possibly lost: 3,400 bytes in 10 blocks
==316==    still reachable: 18,799 bytes in 122 blocks
==316==         suppressed: 0 bytes in 0 blocks

I am less worried about the still reachable bytes because as far as I
understand that is normal
at times and not really a memory leak but am more worried about the
possibly lost bytes. Am i doing
anything inappropriate with my dbus code that could lead to this as I
cant really understand why I am
getting these possibly lost bytes or where they are possibly lost?

Thanks for the help,

 Ernast


More information about the dbus mailing list