According to Ken:
program allo2; var mm: array[1..500000] of real; indx : __long__ integer;
(* JFYI, `__long__ Integer's have 64 bits. For your program, an ordinary 32-bit `Integer' would be sufficient. *)
ma: array[1..500000] of real; [...]
This program realy does nothing of value but when the second FOR loop is running, the program starts eating up memory.
Really at the second FOR loop, not already at the first one? I don't know the details of the memory management of Linux, but AFAIK, the storage is physically allocated when the array is referenced.
According to TOP, the program uses 8094 kBytes just before the loop ends. Why should this program be so memory hungry at that time? [...]
Simply because one `Real' has eight bytes, and you are allocating one million of `Real's. 8000000 bytes are 7812.5kB; if you include code, runtime library, etc., 8094kB seems realistic for me.
Peter
Dipl.-Phys. Peter Gerwinski, Essen, Germany, free physicist and programmer peter.gerwinski@uni-essen.de - http://home.pages.de/~peter.gerwinski/ [970201] maintainer GNU Pascal [970714] - http://home.pages.de/~gnu-pascal/ [970125]