[gtkada] Memory leak in Win32 version

Michael Bode michael.bode at laserline.de
Tue Jun 14 14:44:37 CEST 2005


I've written an app using Gtkada and libglade (I know this is not the 
preferred method). This app has one visible window and in a frame in 
that window one of 4 notebooks is displayed. The user can choose which 
notebook to display by clicking on a group of radio buttons. Each of the 
notebooks has it's "home" window which is invisible. Switching is done 
by reparenting the notebook from its invisible window into the visible 
window. This is the code:

   type View_Type is (Operation, Configuration, Diagnosis, Scope);

   -- Operation_NB.Notebook : Gtk_Notebook
   -- Operation_NB.Window   : Gtk_Window
   -- ...
   procedure View_Cb (Button : access Gtk.Button.Gtk_Button_Record'Class;
                      View   :        View_type)
   is
   begin
      if View = Main_Window.Active_View then
         return;   -- no switching required
      end if;
      case Main_Window.Active_View is
         when Operation =>
            Reparent (Operation_NB.Notebook, Operation_NB.Window);
         when Configuration =>
            Reparent (Config_NB.Notebook, Config_NB.Window);
         when Diagnosis =>
            Reparent (Diag_NB.Notebook, Diag_NB.Window);
         when Scope =>
            Reparent (Scope_NB.Notebook, Scope_NB.Window);
      end case;

      Main_Window.Active_View := View;

      case Main_Window.Active_View is
         when Operation =>
            Reparent (Operation_NB.Notebook, Main_Window.NB_Frame);
         when Configuration =>
            Reparent (Config_NB.Notebook, Main_Window.NB_Frame);
         when Diagnosis =>
            Reparent (Diag_NB.Notebook, Main_Window.NB_Frame);
         when Scope =>
            Reparent (Scope_NB.Notebook, Main_Window.NB_Frame);
      end case;
   end View_Cb;

When switching from Config_NB.Notebook to Diag_NB.Notebook simply these 
two procedure calls are executed:

Reparent (Config_NB.Notebook, Config_NB.Window);  -- to invisible window
Reparent (Diag_NB.Notebook, Main_Window.NB_Frame); -- to visible window

This all works fine on Linux. I've a demo mode which emits signals to 
the switching buttons every 10 seconds and the program ran fine for 24h. 
(Debian Sarge, GtkAda 2.4.0.4, Gtk+ 2.6.4)

On Windows every switch consumes between 300kB and 500kB of memory and 
the machine becomes unusable after about 15min. (GtkAda 2.4.0 from 
libre.act-europe.fr).

It might have something to do with the fact, that all the widgets are 
created using libglade, but I doubt it. Libglade is used in the Linux 
version also (the GUI code is exactly the same), and after the widget 
creation libglade is not used any more.

Are there known memory leaks in the Gtk+ that comes with GtkAda for Windows?

With what Gtk+ versions is GtkAda 2.4 compatible, exactly? From Linux it 
seems it should work with Gtk+ 2.6 also.

-- 
Michael Bode
Laserline GmbH
Fraunhoferstr.
56218 Mülheim-Kärlich
Phone:     +49 2630 964-2200
Fax:       +49 2630 964-2209




More information about the gtkada mailing list