Problems with Styles (was Re: [gtkada] Tasking with GtkAda for newbies)

Emmanuel Briot briot at gnat.com
Fri Feb 9 16:11:23 CET 2001


 > If I don't change any of the styles the memory is constant, but if I do:
 > 
 >    Style := Copy (Get_Style (Notify_Dialog));
 >    -- I commented out the changes
 >    Set_Style (Notify_Dialog.Base_Ebox, Style);
 > 
 > then it grows

You have to explicitely Unref the style the style to free the memory allocated
for it.


 > but if I change it to:
 > 
 >    Gtk_New (Style);
 >    Style := Get_Style (Notify_Dialog.Base_Ebox);
 >    -- I commented out the changes
 >    Set_Style (Notify_Dialog.Base_Ebox, Style);
 > 
 > Then it is steady.

I doubt it remains really stable, since Gtk_New does allocate some memory.
In fact, I don't think it is needed at all in that context, since Get_Style
just returns a pointer to the structure.
But Gtk_New probably allocates less memory than Copy does, so the memory leake
might be growing slowier.

Emmanuel




More information about the gtkada mailing list