Re: Memory leak in gtk+ ??




briot@gnat.com writes:

> The following bug report was reported to the GtkAda team (of course, it was in
> Ada at the time, the code below is a quick translation).
> 
> When you run and compile the code below, the application uses more and more
> memory.
> This problem does not appear if we get rid of the "gtk_show" statements, in
> which case the memory usage remains at the same level during the life of the
> application (this is just what we see with top, nothing more elaborate).

I'm pretty sure that most of what are seeing is growith in the X event
queue - you keep on causing more and more events to be generated,
but never run gtk_main(), so none of these events are ever
processed. Also, since events are not being processed, GDK is never
doing all of the cleanup for the windows it creates; some of the
cleanup is only done when it receives the DestroyNotify event. 

When I modify your program to call the create/destroy in a timeout,
I see no growth in memory allocation at all after the first 
iteration or two.
 
> I have tried to use the g_mem_profile function, but apparently it only gives
> what was allocated, not what was not freed. I also did a difference between
> the output when creating 10 and 500 widgets, but no obvious problem there, so
> I don't really know.
> 
> Any hint/help/fix would be appreciated. I am willing to help in fixing that,
> but I don't really know where to go from here.

My tool memprof (http://people.redhat.com/otaylor/memprof/) is pretty 
nice for tracking down memory leaks.

Regards,
                                        Owen




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]