Strange Memory problem in Lazarus! lazarus / 1-Linux ---------------------------------------------------------------------- Robert W.B. · 2012-04-01 15:37 Hi Friends. I have Linux Ubuntu amd64 and Lazarus 0.9.30.2. In my Lazarus program,that I made I declared this as global:(This is a large statistic program that works fine in Delphi 4) numbers:array[1..10000,1..20]of integer; numberstxt:array[1..10000]of string; datetxt:array[1..10000]of string; odd:array[1..10000]of string; even:array[1..10000]of string; pr:array[1..10000]of string; back:array[1..10000]of string; row:array[1..10000]of string; nr2:array[1..10000]of string; best:array[1..10000]of string; lowest:array[1..10000]of string; t:array[1..10000]of string; srt:array[1..10000]of string; inrow:array[1..10000]of string; ownsttxt:array[1..10000]of string; worked:array[1..10000]of string; rowinrow:array[1..10000]of string; rowinrowtxt:array[1..10000]of string; nrr1:array[1..10000]of string; statistic1:array[1..10000]of string; md:array[1..10000]of string; filtxt:textfile; antal:integer; I pick up 6000 numbers and place then in my variable numbers(declared 10000,20) and in numberstxt(declared 10000). antal is 6000 and store it in my textfile like this: assignFile(filtxt,'vikingrader.dbs'); rewrite(filtxt); writeln(filtxt,antal); for a2:=1 to antal do begin writeln(filtxt,numberstxt(.a2.)); writeln(filtxt,datetxt(.a2.)); end; for a2:=1 to antal do begin for b2:=1 to 20 do begin writeln(filtxt,numbers(.a2,b2.)); end; end; closefile(filtxt);  Here is the problem. When I look in the textfile I see that the texfile can't store the whole 6000,20 numbers in the textfile when the declaration is 10000,20? and not loading it either! Solution: If I lower my declaration of variables from 10000,20 to 7000,20   , the file saves all 6000,20 numbers variable! Is this a Memoryproblem in Linux,Lazarus ?    Best regards Rob ---------------------------------------------------------------------- Blaazen · 2012-04-01 16:18 Your code works well here. I declared 10000,20. Output file contains: 6000 followed by 12000 empty lines followed by 120000 zeros (totally 132001 lines). No idea where is problem. Maybe mode? I use {$mode objfpc} ---------------------------------------------------------------------- Robert W.B. · 2012-04-01 18:33 Hi Blaazen. Have You filled up the array numbers with 6000,20 rows and save it in a textfile and the try to load it again! the textfile I can't see that all the 6000 rows is in the textfile but,when i declare my numbers array from 10000,20 to 7000,20 all 6000,20 numbers is saved and also it could be loaded in my project! The anything to get this to work for me is to declare the numbers variable from 10000,20 to 7000,20? Really strange way to solve the problem! Also,I have in the nearest future have to declare numbers to 15000,20 to fit all the statististic I will need. Best regards Rob ---------------------------------------------------------------------- Blaazen · 2012-04-01 18:42 Can you paste here your code for loading data from textfile? It will help us to help you. ---------------------------------------------------------------------- Robert W.B. · 2012-04-01 19:31 //    Here is the code to fill the array but Yoy also need the beginning code that I wrote before. Note! the numberstxt array shall be exluded and not used but,the rest of the declared variables should be in the code for the project. A listbox and a button needed on a form. See if after You saving it to a textfile,that You can load the numbersarray into the listbox again. procedure TForm1.Button1Click(Sender: TObject); var   a,b,c,d:integer;   antal:integer;   numbers:array[1..10000,1..20]of integer; begin  antal:=6000;  c:=80;  for a:=1 to antal do begin  for b:=1 to 20 do begin   numbers[a,b]:=random(c);  end;  end;  listbox1.Clear;  for d:=1 to antal do begin  listbox1.items.add(IntToStr(numbers[d,1])+','+IntToStr(numbers[d,2])  +','+IntToStr(numbers[d,3])+','+IntToStr(numbers[d,4])+','+IntToStr(n umbers[d,5])  +','+IntToStr(numbers[d,6])+','+IntToStr(numbers[d,7])+','+IntToStr(n umbers[d,8])  +','+IntToStr(numbers[d,9])+','+IntToStr(numbers[d,10])+','+IntToStr( numbers[d,11])  +','+IntToStr(numbers[d,12])+','+IntToStr(numbers[d,13])+','+IntToStr (numbers[d,14])  +','+IntToStr(numbers[d,15])+','+IntToStr(numbers[d,16])  +','+IntToStr(numbers[d,17])+','+IntToStr(numbers[d,18])  +','+IntToStr(numbers[d,19])+','+IntToStr(numbers[d,20])  );  end; end; regards Rob   // ---------------------------------------------------------------------- marcov · 2012-04-01 20:10 Make the variable global. Local variables are allocated from the stack, which is typically limited to something in the magnitude of 1MB on Linux. ---------------------------------------------------------------------- Blaazen · 2012-04-01 20:39 Isn't default linux stack size 8MB ? ---------------------------------------------------------------------- marcov · 2012-04-01 21:01 Quote from: Blaazen on April 01, 2012, 10:39:22 pmIsn't default linux stack size 8MB ? I guess it changes every couple of years as avg memory progresses, and might depend on distro. ---------------------------------------------------------------------- Robert W.B. · 2012-04-01 23:13 In my project the variables are global. Just the one ex: i filled with random numbers are in the exampel is local. I got the memory problem even if variables are global in Ubuntu amd64. double core,4gb ram Isn't default linux stack size 8MB ? What is it for Windows 7,Local Global? Regards Rob