|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
为什么这个过程.运行一段时候后,虚拟内存就彪到3个G,然后就out of memory.
试过去掉ClearMemory;如果去掉,虚拟内存和真实内存一起爆....请高人指点啊.给个方向也好..
procedure TForm1.Button40Click(Sender: TObject);
var
URL_929 : string;
idhttp1 : TIdHTTP;
F : TextFile;
list : TStringList;
JSArray : TJSONArray;
json :string;
begin
b:=True;
IdHTTP1 := TIdHTTP.Create(nil);
IdHTTP1.ReadTimeout := 30000;
IdHTTP1.Request.Accept := '*/*';
IdHTTP1.Request.AcceptLanguage := 'zh-cn';
IdHTTP1.Request.AcceptEncoding := 'gzip, deflate';
IdHTTP1.Request.UserAgent :='Mozilla/5.0 (compatible; MSIE 6.0; Windows NT 5.1)';
IdHTTP1.HTTPOptions:=IdHTTP1.HTTPOptions+[hoKeepOrigProtocol];
IdHTTP1.ProtocolVersion:=pv1_1;
IdHTTP1.HandleRedirects:=true;
AssignFile(F,'K.csv');
rewrite(F);
closefile(F);
dn:=0;
repeat
ci:=0;
List:=TStringList.Create;
repeat
url_929:='http://www.xxxx.com';
if b then
begin
json:= nxgeturl(idhttp1,URL_929,debug1,edit1,5000);//自写的idhttp函数.
if (Length(json)>6) and (Pos('对不起,页面不存在!',json)=0) then begin
list.Add(m_json(json).Text);//这个是自写的处理json的函数.
end else unit3.Form3.bigdebug.Lines.Add(button16.Caption+':错误 '+ c58+' | '+c59);
end else exit; Application.ProcessMessages;
ci:=ci+1;
until ci=memo2.Lines.Count;
Append(F);
Write(F,list.Text);
CloseFile(F);
FreeAndNil(list);
ClearMemory;
dn:=dn+1;
until dn = Trunc(dtp2.Date) - Trunc(dtp1.Date) + 1;
debug2.Lines.Add(button40.caption+' complate...');
ClearMemory;
end;
//清理内存过程...
procedure TForm1.ClearMemory; begin if Win32Platform = VER_PLATFORM_WIN32_NT then begin SetProcessWorkingSetSize(GetCurrentProcess, $FFFFFFFF, $FFFFFFFF); application.ProcessMessages; end; end;
|
|