我在处理每个文件的时候 已经释放了啊,怎么到第22个文件的时候就内存溢出了啊,每个单独做都没问题,前面21个文件总和差不多将近600M,总计差不多400个文件,部分代码如下 List := TStringList.Create; ///逐个文件进行统计
for j := 0 to 400 do //400个文件
begin
bString := SplitString(distList.Strings[j],'|'); ///分割行
strDist := bString[1]; ///取省市名
strCode := bString[0]; ///取pcode try ///程序运行的状态条
ImpPanel.Visible := True;
ImpPanel.Caption := '正在处理文件 ' + 'addr_'+strCode+'_out.txt' + ' 请稍候!!!';
ImpPanel.Repaint; List.LoadFromFile(Cur_Path+'\addr_bz_out\'+'addr_'+strCode+'_out.txt'); ///载入要取省市的数据 ///初始化变量
Str1 := '';
Str2 := '';
countBI_all := 0;
countUNIQ_all := 0;
countBI_equal := 0;
countUNIQ_equal := 0;
countBI_unequal := 0;
countUNIQ_unequal := 0;
countSUM := List.Count; ///逐条数据进行取出统计
for i := 0 to List.Count - 1 do
begin
aString := SplitString(List.Strings[i],'|');
Str1 := aString[0];
Str2 := aString[3]; if copy(Str1,1,2)='@@' then
begin
countBI_all := countBI_all+1;
if Str2='一致' then
countBI_equal := countBI_equal+1
else
countBI_unequal := countBI_unequal+1;
end ; end;
Sleep(100); ///为了更清楚看到执行的过程,可以省略此处
ImpPanel.Visible := false;
finally
List.Clear;
List.Free;
end;
end;
for j := 0 to 400 do //400个文件
begin
bString := SplitString(distList.Strings[j],'|'); ///分割行
strDist := bString[1]; ///取省市名
strCode := bString[0]; ///取pcode try ///程序运行的状态条
ImpPanel.Visible := True;
ImpPanel.Caption := '正在处理文件 ' + 'addr_'+strCode+'_out.txt' + ' 请稍候!!!';
ImpPanel.Repaint; List.LoadFromFile(Cur_Path+'\addr_bz_out\'+'addr_'+strCode+'_out.txt'); ///载入要取省市的数据 ///初始化变量
Str1 := '';
Str2 := '';
countBI_all := 0;
countUNIQ_all := 0;
countBI_equal := 0;
countUNIQ_equal := 0;
countBI_unequal := 0;
countUNIQ_unequal := 0;
countSUM := List.Count; ///逐条数据进行取出统计
for i := 0 to List.Count - 1 do
begin
aString := SplitString(List.Strings[i],'|');
Str1 := aString[0];
Str2 := aString[3]; if copy(Str1,1,2)='@@' then
begin
countBI_all := countBI_all+1;
if Str2='一致' then
countBI_equal := countBI_equal+1
else
countBI_unequal := countBI_unequal+1;
end ; end;
Sleep(100); ///为了更清楚看到执行的过程,可以省略此处
ImpPanel.Visible := false;
finally
List.Clear;
List.Free;
end;
end;
解决方案 »
- delphi 如何取得网页源码中的字符串?
- 图像叠加 透明 TransparentBlt
- 几十M的文本文件用什么方法读取最快?
- FastReport报表如何设计出一个主数据集对多个从数据集的报表?
- 主进程serversocket,多client上线,怎么把收到的报文交给每个打开的和单一client信息交互的窗口?
- ** 不同单元间的动态数组赋值 **
- 急呀,关于焦点和关闭外部应用程序的问题!百分感谢!
- ★★MSN - 纯净的天空!交友连谊会!有MSN的朋友快进来报道!★★
- sum问题
- 给打印机设置自定义纸张失败(有代码)
- 求助鼠标拖出文件方法,谢谢了!
- delphi中关于TChart控件使用的问题
for j := 0 to 400 do //400个文件
begin
下。
try
///逐个文件进行统计
for j := 0 to 400 do //400个文件
begin
bString := SplitString(distList.Strings[j], '| '); ///分割行
strDist := bString[1]; ///取省市名
strCode := bString[0]; ///取pcode
///程序运行的状态条
ImpPanel.Visible := True;
ImpPanel.Caption := '正在处理文件 ' + 'addr_ '+strCode+ '_out.txt ' + ' 请稍候!!! ';
ImpPanel.Repaint; List.LoadFromFile(Cur_Path+ '\addr_bz_out\ '+ 'addr_ '+strCode+ '_out.txt '); ///载入要取省市的数据 ///初始化变量
Str1 := ' ';
Str2 := ' ';
countBI_all := 0;
countUNIQ_all := 0;
countBI_equal := 0;
countUNIQ_equal := 0;
countBI_unequal := 0;
countUNIQ_unequal := 0;
countSUM := List.Count; ///逐条数据进行取出统计
for i := 0 to List.Count - 1 do
begin
aString := SplitString(List.Strings[i], '| ');
Str1 := aString[0];
Str2 := aString[3]; if copy(Str1,1,2)= '@@ ' then
begin
countBI_all := countBI_all+1;
if Str2= '一致 ' then
countBI_equal := countBI_equal+1
else
countBI_unequal := countBI_unequal+1;
end ; end;
Sleep(100); ///为了更清楚看到执行的过程,可以省略此处
ImpPanel.Visible := false;
end;
finally
List.Free;
end;