超级郁闷的事情:单步执行到某步的时候,再按F9运行没问题!但是如果不设置断点,运行的时候会出现错误!
下面是错误提示:
---------------------------
Debugger Exception Notification
---------------------------
Project MingS.exe raised exception class EAccessViolation with message 'Access violation at address 03516828. Write of address 00000000'. Process stopped. Use Step or Run to continue.
---------------------------
OK   Help   
---------------------------
唉,有的时候重启再执行又没问题,唉!烦啊!

解决方案 »

  1.   

    ---------------------------
    Debugger Exception Notification
    ---------------------------
    Project MingS.exe raised exception class EStackOverflow with message 'Stack overflow'. Process stopped. Use Step or Run to continue.
    ---------------------------
    OK   Help   
    ---------------------------有时候是提示这个错误!堆栈溢出!
      

  2.   

    1:引用了第三方控件没,如果有,删除试试, 如果不能删,将该控件包内的一些单元也手工添加到单元引用头uses后面试试2:如果没引用第三方控件,看看你的代码中资源释放逻辑是否有问题
      

  3.   

    begin
        if length(mystates)<>FCountP then
          setlength(mystates,FCountP);
        showmessage(inttostr(high(mystates)));
        for i:=0 to high(mystates) do
          updatestate(page*fcountP+i);
      end;
    错误是在这段,发现i到了50左右的时候,提示出错,就是说0000000位置的地方读写错误,但是第一次执行的过程中是没有这个问题的。
      

  4.   

    我在中间加一个showmessage是以为自己的对象数组越界了,但是看到的提示没有越界。updatestate过程是更新控件的一些数据而已,如果出现的那个数组成员的位置是000000难道说那个对象已经不存在了?还是我这个对象数组所分配的内存空间超过了一个默认的规定?
      

  5.   

    我现在单步执行的时候,执行到i=50左右就一步一步地慢慢运行,没提示错误,执行完循环了,我就按F9就提示
    ---------------------------
    Debugger Exception Notification
    ---------------------------
    Project MingS.exe raised exception class EStackOverflow with message 'Stack overflow'. Process stopped. Use Step or Run to continue.
    ---------------------------
    OK   Help   
    ---------------------------
      

  6.   

    在加断点的地方加一个延迟函数Sleep(100);测试看看
      

  7.   

    我也遇到过同样的问题,是在我的程序退出的时候,单步调就可以顺利关闭,但直接运行就弹楼主所说的错误对话框,后来我把exit换成application.terminate就可以了,我怀疑是重复释放了什么东西,不过解决了就没再深究,我的代码如下
     Application.Initialize;  Form3:=Tform3.Create(Form3);
      Frmlogin:=Tfrmlogin.Create(Frmlogin);
      Frmlogin.ShowModal;
      if not isloginin then Application.Terminate;  Application.CreateForm(TFrmMain, FrmMain);
      Application.CreateForm(TFrmQuery, FrmQuery);
      Application.CreateForm(TFrmWait, FrmWait);
      //Application.CreateForm(TForm1, Form1);
      Application.Run;其中在Frmlogin里动态创建了ini文件
    cfgini:=Tinifile.Create(path+'config.ini');
    不过我在关闭窗体的时候已经释放了:
    procedure TFrmLogin.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
        cfgini.free;
    end;
      

  8.   

    在这先谢谢各位的关注了!我给出下面的代码,我想主要是这部分的错误,但是编译是没问题的。-------------------------------------------
    //制作每页Item的过程,但是具体的items由各自的子类去实现
    var
    itemCount,i,j:integer;//i:数据集的循环标志,j:雇员循环标记,k当前搜索到的,号的位置
    strEM:string;
    begin
    //1:计算page的Item数量(判断当前是否是最后一页,是的话,则要计算了)
    //page的开始也是从0开始的
      p_item.Visible:=false;  RG_Page.Enabled:=false;
      if page<0 then exit;  if page=FpageCount-1 then//最后一页
      begin
        if FPageCount>1 then
          itemcount:=mydata.RecordCount-page*FCountP
        else
          itemcount:=mydata.RecordCount;
      end
      else
        itemcount:=FCountP;  if length(mystates)<itemcount then
        setlength(mystates,itemcount);  //停止item的倒计时控件作用
      if assigned(mystates[0]) then
        mystates[0].StopForUpdate;  for i:=0 to high(mystates) do
      begin
        if i<itemcount then
          updatestate(page*FcountP+i)
        else
          freeandnil(mystates[i]);
      end;
      //重新开启item的倒计时控件作用
      if assigned(mystates[0]) then
        mystates[0].BeginAfterUpdate;
      if length(mystates)>itemcount then
        setlength(mystates,itemcount);
      if (mystates[0].Top=mystates[itemcount-1].Top) and (mystates[0].left=mystates[itemcount-1].left) then
        pailieall;  Sleep(900);
      p_item.Visible:=true;
      RG_Page.Enabled:=true;
      FShowCount:=itemcount;
    -------------------------------------------
      

  9.   

    楼主看有没有可以举一反三的地方,或者楼上的高手帮我看看为什么exit不行
      

  10.   

    Form3:=Tform3.Create(Form3);
      Frmlogin:=Tfrmlogin.Create(Frmlogin);
      Frmlogin.ShowModal;
      freeandnil(Frmlogin);//释放你刚才showmodal出来的窗体(这步是在Frmlogin关闭之后才执行的!)
      

  11.   

    //给个例子你看看吧,这是我程序的开始部分所执行的!
      Application.Initialize;
      Frm_Loading:=TFrm_Loading.Create(application);
      Frm_Loading.Show;
      Frm_Loading.Update;
      Application.CreateForm(TDM, DM);
      Application.CreateForm(TMainForm, MainForm);
      Frm_Loading.Destroy;
      Login:=TLogin.Create(nil);
      login.ShowModal;
      login.Free;
      login:=nil;  
      Application.Run;
      

  12.   

    if length(mystates)<itemcount then 这个mystates是在那里怎么定义的?
      

  13.   

    楼主同志,我也遇到过这样的问题.也是SetLength这个里面出错.后来发现错误原因不是这里,是代码前段部分赋值出错.你可以看看你的程序代码前段,不要专注于这个过程里.
      

  14.   

    mystates:array of TZState;全局变量。发现要是使用一组对象的话,千万别使用对象数组啊,要用就使用TList,要是使用数组的话,很容易出现内存溢出,因为数组分配的是连续的内存空间,而TList就不是,它只记录对象指针,所以创建的对象组分配的不是连续的内存空间,现在我就是使用了TList的方法做了,问题也解决了,之前使用对象数组确实是不知明的内存溢出,整个思路是没有任何的问题。但是TList的方式,运行起来,数组的快点,TList慢点!