Z
zdwrq
Unregistered / Unconfirmed
GUEST, unregistred user!
动态数组最大有多大,以下的代码在我的机器上i不到8000就会
“out of memory”,256M的内存!!用固定数组也一样,但我用StringGrid里面
的Cells数组可以到3万左右,Why?有没有解决办法,我需要一个很
大的数组,10万以上,请大家帮忙!
procedure TForm1.Button1Click(Sender: TObject);
type
rdAA=record
a1,a2,a3,a4,a5:String;
end;
var
arAA:array of rdAA;
i:integer;
begin
for i:=1 to 1000000 do
begin
SetLength(arAA,i);
arAA[i-1].a1:='AAAAAAAAAAAAA';
arAA[i-1].a2:='AAAAAAAAAAAAA';
arAA[i-1].a3:='AAAAAAAAAAAAA';
arAA[i-1].a4:='AAAAAAAAAAAAA';
arAA[i-1].a5:='AAAAAAAAAAAAA';
Caption:=IntToStr(i);
end;
end;
“out of memory”,256M的内存!!用固定数组也一样,但我用StringGrid里面
的Cells数组可以到3万左右,Why?有没有解决办法,我需要一个很
大的数组,10万以上,请大家帮忙!
procedure TForm1.Button1Click(Sender: TObject);
type
rdAA=record
a1,a2,a3,a4,a5:String;
end;
var
arAA:array of rdAA;
i:integer;
begin
for i:=1 to 1000000 do
begin
SetLength(arAA,i);
arAA[i-1].a1:='AAAAAAAAAAAAA';
arAA[i-1].a2:='AAAAAAAAAAAAA';
arAA[i-1].a3:='AAAAAAAAAAAAA';
arAA[i-1].a4:='AAAAAAAAAAAAA';
arAA[i-1].a5:='AAAAAAAAAAAAA';
Caption:=IntToStr(i);
end;
end;