I get an EStackOverflow error message when creating a packed structure in delphi 7.0

I get EStackOverflow when creating a packed structure in Borland Delphi 7.0

I want to do the following:

Type

 T4 = packed record
     VT  : integer;
     SKT : byte;
  end;

  T3 = packed record
     O : boolean;     
     TT4 : array of T4;  
  end;

  T2 = packed record
     con  : boolean;
     TT3 : array [64..90,64..90] of T3;
  End;

  TTT = array [64..90,64..90] of T2;


procedure TForm1.Button1Click(Sender: TObject);
var  
   Arr  : TTT;
begin 
        Arr[64,64].con:=false;
end;

But when I run the program and click the button, I get an EStackOverflow error in the line begin Button1Click.

Can someone help me?

+5
source share
2 answers

Simple, created elements are too large for the default stack size. Either increase this when creating the stream, or allocate memory on the heap. In any case, it works.

Just do the math:

sizeof(T4) = 5
sizeof(T3) = 5
sizeof(T2) = 3646 // if I'm right
sizeof(TTT)= 2657934
+12
source

, .

:

. , .

+2

All Articles