Re: Signal memory leak.



> Karl Nelson <kenelson@ece.ucdavis.edu> writes:
> >         cid=gtk_signal_connect_object((GtkObject*)w,"clicked",
> >                                       (GtkSignalFunc)Foo,
> >                                       (GtkObject*)w2);
> 
> You never destroy "w" and you keep adding connections, so it has
> continuously increasing memory use (also the speed of
> gtk_signal_connect() starts to get really crappy... we seem to have an
> O(n) list append in there ;-)
> 
> memprof shows no actual leaks, a pointer to all memory is retained.

True, it is not a leak in the sense of being lost memory.  However,
it is memory which is being taken from the system.  In libsigc, 
all these cases got handled so that when a connection is shared
between 2 objects has one partner broken it disconnects the other.
What was the intent here?


> >         gtk_object_sink((GtkObject*)w2);
> 
> w2 is destroyed but not w...

Should the user expect the connection to be severed or not?  If not
then wouldn't the user get an error if they attempt to use this connection?

--Karl



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