Allocation/Memory Leak question

Fri, 25 Jul 1997 15:09:37 -0700


Just a quick note/question/observation.

Consider this program:
----------------------------------------------------------------------------
program allo2;
var
   mm: array[1..500000] of real;
   indx : __long__ integer;
   ma: array[1..500000] of real;
begin
   for indx := 1 to 500000 do
   begin
      mm[indx] := indx / 2.2;
      if indx = 1 then
         ma[indx] := 1.0
      else
         ma[indx] := (ma[indx-1] + mm[indx]) / indx;
   end;
   for indx := 1 to 500000 do
      writeln(indx, mm[indx], ma[indx]);
end.
----------------------------------------------------------------------------
This program realy does nothing of value but when the second FOR
loop is running, the program starts eating up memory.  According to TOP,
the program uses 8094 kBytes just before the loop ends.  Why should
this program be so memory hungry at that time?  FYI, I am using 
GPC 2.0 with Linux 2.???

later... 
Ken L.


Ken (kc7rad@vegasnet.net)

HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada - Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es