Re: [gnet-dev] Possible Memory Leak
- From: Hubert Sokolowski <h sokolowski wsisiz edu pl>
- To: gnet-dev lists gnetlibrary org
- Subject: Re: [gnet-dev] Possible Memory Leak
- Date: Wed, 26 Jan 2005 17:17:15 +0100
On Wed, 26 Jan 2005 13:13:14 +0100
Carsten Burstedde <c burstedde de> wrote:
> I experience the following:
>
> 1. valgrind does not like the glib mem profile functions, so I removed
> them.
> 2. the memory seems to be allocated in g_ptr_array_sized_new.
> 3. when I do instead
>
> context = g_main_context_default ();
> loop = g_main_loop_new (context, FALSE);
>
> ...
>
> g_main_loop_unref (loop);
> g_main_context_unref (context);
>
> the leak disappears completely. So it is probably in the source
> handling of the main context and finally cleaned up. But then the
> static GMainContext *default_main_context is dangling nonzero inside
> glib, which is dangerous. Maybe propose a patch to
> g_main_context_unref
> to fix this?
this looks like a bug in glib. you could report this to
gtk-app-devel-list gnome org mailing list.
I am not sure if context returned by g_main_context_default ();
should be freed by the user, the docs does not says about it.
>
> 4. In my _real_ gnet programs, valgrind says
> ==29743== warning: Valgrind's pthread_getschedparam is incomplete
> ==29743== your program may misbehave as a result
> And it does no longer respond to the Ctrl-D on stdin and network
> connects for example. Is there a possibility to fix this (redhat 9,
> glib 2.6.1)?
yeah, valgrind is useless for threaded applications.
when you remove gnet code valgrind reports memleaks, run it with
valgrind --tool=memcheck --leak-check=yes progrname
hs
ps. remember about gnet_init :)
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]