鱼C论坛

 找回密码
 立即注册
查看: 1847|回复: 1

关于虚拟内存"爆表"~

[复制链接]
发表于 2014-10-8 00:20:44 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

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;




想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

头像被屏蔽
发表于 2014-11-1 06:21:13 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-5-9 09:11

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表