Re: Memory Leak with gtk_timeout_add
- From: Sven Neumann <sven gimp org>
- To: Dave Caswell <davec asylum apocalypse org>
- Cc: gtk-list gnome org
- Subject: Re: Memory Leak with gtk_timeout_add
- Date: 01 Aug 2001 12:20:45 +0200
Hi,
Dave Caswell <davec asylum apocalypse org> writes:
> I put #if 0 around all the code in my timeout function, as well as all
> my drawing code and the memory consumtion continues. It really looks
> like there's a memory leak in the timeout functions in gtk itself.
from a quick look at your source, I got the impression what you are
doing is essentially:
gboolean
timeout_event (gpointer data)
{
gtk_timeout_add (delay, timeout_event, data);
return TRUE;
}
int
main (void)
{
gtk_timeout_add (delay, timeout_event, data);
gtk_main();
}
this will of course eat all your CPU and memory since you adding a
new timeout each time the timeout_event is handled. The number of
timeouts registered to the main loop goes up exponentially. I'd
suggest you read http://gtk.org/tutorial/ch-timeouts.html#SEC-TIMEOUTS
Then, consider using g_timeout_add() from GLib directly instead of
the GTK wrappers.
Salut, Sven
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]