Re: Widgets and memory management



Hi,

Ian King <king eiffel com> writes:

> Is there any decent documentation I can look at to find out about the memory 
> management system employed in gtk.  I need to know certain things such as. 
> 
> If a container gets destroyed, does it destroy its children?

if you add a widget to a container, the container takes ownership, i.e.
it refs the widget and sinks it. If the container gets destroyed it 
drops the references it holds to it's children. Thus if a child widget was 
floating before being added (all widgets are created floating) and it was 
not explicitely additionally ref'ed, the children will be destroyed and 
finalized.

> If I have an object that is always floating, will an object_sink cause the 
> memory to be deallocated?

I don't know what you mean by "always floating", but gtk_object_sink()
will indeed lead to object destruction and finalization if the object
state is floating and it had no additional refcounts.

The finalization process includes the deallocation of all memory allocated
for the object.


Salut, Sven




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