delphi老是在这个部分中显示错误,显示project raised exception class EOutOfMemory with message 'Ouf Of Memory',
实在找不到错在哪,有没有大大能帮个忙。
procedure TForm1.SupportSubset(ArrayOA1,ArrayOB1:Tarray);
var
a,b,c,d,e,h:integer;
g:extended;
str1,str2:string;
begin
try
for a:=0 to FMedicineList1.count-1 do
for b:=0 to FMedicineList2.Count-1 do
begin
New(FMedicine1);
FMedicine1:=FMedicineList1[a];
str1:=FMedicine1.string1;
New(FMedicine1);
FMedicine1:=FMedicineList2[b];
str2:=FMedicine1.string1;
if str1=str2 then
continue
else
begin
h:=0;
for c:=0 to Length(ArrayOA1)-1 do
for d:=0 to Length(ArrayOA1[c])-1 do
begin
New(FMedicine1);
FMedicine1:=FMedicineList1[a];
if FMedicine1.string1=ArrayOA1[c][d] then
begin
for e:=0 to Length(ArrayOB1[c])-1 do
begin
New(FMedicine1);
FMedicine1:=FMedicineList2[b];
if FMedicine1.string1=ArrayOB1[c][e] then
begin
inc(h);
break;
end;
end;
break;
end;
end;
if length(ArrayOA1)<>0 then
begin
g:=h/length(ArrayOA1);
if g>=strtofloat(edit8.text) then
begin
if g<=strtofloat(edit9.text) then
begin
New(FMedicine1);
FMedicine1:=FMedicineList1[a];
str1:=FMedicine1.string1;
New(FMedicine1);
FMedicine1:=FMedicineList2[b];
str2:=FMedicine1.string1;
New(FMedicine2);
FMedicine2.string1:=str1;
FMedicine2.string2:=str2;
FMedicineList3.add(FMedicine2);
end;
end;
end;
end;
end;
except
showmessage('SupportSubset Error');
end;
end;
实在找不到错在哪,有没有大大能帮个忙。
procedure TForm1.SupportSubset(ArrayOA1,ArrayOB1:Tarray);
var
a,b,c,d,e,h:integer;
g:extended;
str1,str2:string;
begin
try
for a:=0 to FMedicineList1.count-1 do
for b:=0 to FMedicineList2.Count-1 do
begin
New(FMedicine1);
FMedicine1:=FMedicineList1[a];
str1:=FMedicine1.string1;
New(FMedicine1);
FMedicine1:=FMedicineList2[b];
str2:=FMedicine1.string1;
if str1=str2 then
continue
else
begin
h:=0;
for c:=0 to Length(ArrayOA1)-1 do
for d:=0 to Length(ArrayOA1[c])-1 do
begin
New(FMedicine1);
FMedicine1:=FMedicineList1[a];
if FMedicine1.string1=ArrayOA1[c][d] then
begin
for e:=0 to Length(ArrayOB1[c])-1 do
begin
New(FMedicine1);
FMedicine1:=FMedicineList2[b];
if FMedicine1.string1=ArrayOB1[c][e] then
begin
inc(h);
break;
end;
end;
break;
end;
end;
if length(ArrayOA1)<>0 then
begin
g:=h/length(ArrayOA1);
if g>=strtofloat(edit8.text) then
begin
if g<=strtofloat(edit9.text) then
begin
New(FMedicine1);
FMedicine1:=FMedicineList1[a];
str1:=FMedicine1.string1;
New(FMedicine1);
FMedicine1:=FMedicineList2[b];
str2:=FMedicine1.string1;
New(FMedicine2);
FMedicine2.string1:=str1;
FMedicine2.string2:=str2;
FMedicineList3.add(FMedicine2);
end;
end;
end;
end;
end;
except
showmessage('SupportSubset Error');
end;
end;
解决方案 »
- 一个简单的DLL调用问题
- mdichild子窗体每一个不是独立线程吗?
- Delphi怎么读出一段字节数值中的几个字节的十进制值
- 唉,郁闷的枚举子窗口问题:EnumChildWindows,
- 支持修罗做语言基础斑竹!!!!
- 有没有地方下载一个Shape控件,它必须含有右键功能和双击功能
- 请问,装了SkinEngine在delphi的控件栏看不见,是不是那里要添加一下?
- isapi 的dll在98 下可以操作注册表,为何在win2000下就不行呢?
- windows里面的图标资源是在哪些文件中?
- 我升级了,^_^,散分,快来啊!
- 如何控制RAVE报表按条件分页来打印.在线等
- 不同线程能不能同时对同一个连接执行发送和接收数据的操作,会不会冲突?
FMedicine1:=FMedicineList1[a];
str1:=FMedicine1.string1;
New(FMedicine1); //这里会导致内存泄漏
从上面的代码看,明显有内存泄漏的现象,而且还被放在循环中执行,最终导致内存耗尽
New(FMedicine1);
FMedicine1:=FMedicineList1[a];
str1:=FMedicine1.string1;
New(FMedicine1);
Dispose(FMedicine1);
这样么。