Hi all, I'm currently evaluating Ada as an alternative to C++ for scientific programming. I have a simple test program that within its main loop repeatedly calls the following procedure: procedure Propagate is Access_Temp : constant Access_Probability_Field := Access_New_Field; begin Access_New_Field.all := (others => (others => (others => 0.0))); for Nx in -Fringe_Index .. Fringe_Index loop -- Fringe_Index = about 50 for Ny in -Fringe_Index .. Fringe_Index loop for Ntheta in Angle_Index'Range loop -- Range = 0 .. 199 begin -- why do I need this? for W of Weight_Vectors (Ntheta) loop -- Weight_Vectors (Ntheta) is a Vector of type Ada.Containers.Vectors -- (Element_Type => Weight, Index_Type => Natural), where Weight is defined as -- subtype Pixel_Offset is Integer range -Max_Offset .. Max_Offset; -- type Weight is record -- Nx, Ny : Pixel_Offset; -- W : Long_Float; -- end record; for D_Index in Angular_Propagator'Range loop Access_New_Field (Nx + W.Nx, Ny + W.Ny, Ntheta + D_Index) := Access_New_Field -- (Nx, Ny + 1, Ntheta) (Nx + W.Nx, Ny + W.Ny, Ntheta + D_Index) + Access_Old_Field (Nx, Ny, Ntheta) * W.W * Angular_Propagator (D_Index); end loop; end loop; end; end loop; end loop; end loop; Access_New_Field := Access_Old_Field; Access_Old_Field := Access_Temp; end Propagate; Access_New_Field and Access_Old_Field are of type access Probability_Field, where type Probability_Field is array (Pixel_Index'Range, Pixel_Index'Range, Angle_Index'Range) of Long_Float; subtype Pixel_Index is Integer range -(Fringe_Index + Max_Offset) .. (Fringe_Index + Max_Offset); my main loop looks like this: Access_New_Field := new Probability_Field; Access_Old_Field := new Probability_Field; for K in 1 .. No_Iterations loop Put_Line ("Iteration " & Integer'Image (K)); Propagate; end loop; What I don't get is that if I comment out the above "begin/end" lines, then memory usage increases with No_iterations and for No_iterations = 8 reaches about 550 MB. Including begin/end reduces memory usage to 37MB (then independent of No_iterations, as it should be). For what it's worth, I'm using the following compiler flags (with GNAT GPL 2011 on Mac OS X 10.7.4, 2010 MacBook Pro): gnatmake -o Main Main -P"/Users/sebastian/Documents/Studium/Research/hard-disk-disorder/lattice-propagator/release.gpr" -g -cargs -gnatq -gnatQ -bargs -largs gcc -c -gnatQ -O3 -gnatp -gnat2012 -g -gnatq -gnatQ -I- -gnatA [�]/Main.adb gcc -c -gnatQ -O3 -gnatp -gnat2012 -g -gnatq -gnatQ -I- -gnatA [�]/lattice_propagator.adb gcc -c -gnatQ -O3 -gnatp -gnat2012 -g -gnatq -gnatQ -I- -gnatA [�]/geometry.adb gnatbind -E -static -I- -x [�]/obj/main.ali gnatlink [�]/obj/main.ali -g -o [�]/build/Main Is this expected behaviour? If yes, could someone please explain what's going on internally? Best regards, Sebastian