我在delphi 7.0中创建打包结构时收到错误EStackOverflow [英] I get an error EStackOverflow when creating packed struct in delphi 7.0

查看:97
本文介绍了我在delphi 7.0中创建打包结构时收到错误EStackOverflow的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Borland Delphi 7.0中创建打包结构时,我得到了EStackOverflow

I'm getting an EStackOverflow when creating a packed struct in Borland Delphi 7.0

我想要执行以下操作:

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;

但是当我运行程序并单击按钮时,在<$ c上出现EStackOverflow错误$ c>开始行, Button1Click

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

有人可以帮助我吗?

推荐答案

简单,创建的项目对于默认堆栈大小而言太大。在创建线程时增加它,或者在堆上分配内存。不管哪种方法都可以。

Simple, the created items are too big for the default stack size. Either increase that when creating the thread or allocate the memory on the heap. Either way works.

只需做一下数学运算即可:

Just do the math on it:

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

这篇关于我在delphi 7.0中创建打包结构时收到错误EStackOverflow的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆