看不懂这个错误大家看一看,
Project 123.exe raised exception class EAccessViolation with
message 'Access violation at address 00404660 in module '123.exe'.
Read of address 0000001A'.
Process stopped.Use Step or Run to continue.
不知道犯了什么错误,Help!

解决方案 »

  1.   

    内存地址发生泄出,你把delphi关闭,再重新进入,打开原来的工程.再运行就没事了.
      

  2.   

    这么看这个错误发生在哪一行?我每次点OK之后就跳到了Program 的 end. 处
      

  3.   

    代码很长,大家看看吧:
    procedure CacheRun();
    var
       Alength,I,J,K: Integer;
       InfStr,TagStr,IndexStr,AllStr: string;
       Tagint,Indexint: Longint;
       match: Boolean; //是否有匹配
       NotFull: Boolean; //有空的映射块
       Swapint: Integer;//被替换的块号
       TimeStrFirIn,TimeStrLRU: string;
    begin
       if WXL = False then
          begin
             Alength := Length(AddrArray);
             for I := 0 to Alength-1 do
               begin
                 AllStr := inttobin(AddrArray[I].Addr,26);
                 TagStr := Copy(AllStr,1,x);
                 IndexStr := Copy(AllStr,x+1,y);
                 Tagint := bintoint(TagStr);
                 Indexint := bintoint(IndexStr);
                 
                 match := False;
                 NotFull := False;
                 for J := Indexint*n+0 to Indexint*n+n-1 do
                     begin
                                      
                        if(MLBArray[J].tag = Tagint)and(MLBArray[J].YXW = True)then
                            begin
                                match := True;
                                HCount := HCount+1;
                                MLBArray[J].TimeStrRec := TimeToStr(Time);
                                AddrArray[I].Hit := True;
                                break;
                            end;
                        if MLBArray[J].tag = -1 then
                               NotFull := True;
                     end;
                 if match = False then
                    begin
                       if NotFull = True then
                          begin
                             for K := Indexint*n+0 to Indexint*n+n-1 do
                                 if MLBArray[K].tag = -1 then
                                    begin
                                        
                                     MLBArray[K].tag := Tagint;
                                     MLBArray[K].TimeStrIn := TimeToStr(Time);
                                     MLBArray[K].TimeStrRec := MLBArray[K].TimeStrIn;
                                     break;
                                    end;
                          end;
                       if NotFull = False then
                          begin
                             if Swap = 1 then
                                begin
                                   Swapint := Indexint*n+Random(n);
                                end;
                             if Swap = 2 then
                                begin
                              TimeStrFirIn := TimeToStr(time;)                       for K:= Indexint*n+0 to Indexint*n+n-1do                                         
                        if AnsiCompareText(MLBArray[K].TimeStrIn,TimeStrFirIn)<0 then
                                     begin
                                               TimeStrFirIn := MLBArray[K].TimeStrIn;
                                                Swapint := K;
                                             end;                            end;
                             if Swap = 3 then
                                begin
                        TimeStrLRU := TimeToSt(time);                              for K:= Indexint*n+0 to Indexint*n+n-1 do
                         if AnsiCompareText(MLBArray[K].TimeStrRec,TimeStrLRU)<0 then
                                             begin
                                                TimeStrLRU := MLBArray[K].TimeStrRec;
                                                Swapint := K;
                                             end;
                                end;
                             MLBArray[Swapint].tag := Tagint;
                             MLBArray[Swapint].TimeStrIn := TimeToStr(Time);
                         MLBArray[Swapint].TimeStrRec := MLBArray[Swapint].TimeStrIn;
                          end;
                    end;           end;      end;   HaveRun := True;
       HitStatistic();
       ComputeRes();
       InfStr := '模拟完成,请通过ViewResult菜单查看模拟结果!';
       MessageDlg(InfStr,mtInformation,[mbOK],0);end;
      

  4.   

    赋上说明:
    TAddrItem = record
             Addr : Longint;
             Hit : Boolean;
             end;
    TMLBItem = record       
           tag : Longint;
           YXW : Boolean;
           TimeStrIn : string;{调入时间字符串}
           TimeStrRec : string;{最近访问时间字符串}
           end;AddrArray : array of TAddrItem;
    MLBArray : array of TMLBItem;
      

  5.   

    重新整了以下,看这个吧
    procedure CacheRun();
    var
       Alength,I,J,K: Integer;
       InfStr,TagStr,IndexStr,AllStr: string;
       Tagint,Indexint: Longint;
       match: Boolean; //是否有匹配
       NotFull: Boolean; //有空的映射块
       Swapint: Integer;//被替换的块号
       TimeStrFirIn,TimeStrLRU: string;
    begin
       if WXL = False then
          begin
             Alength := Length(AddrArray);
             for I := 0 to Alength-1 do
               begin
                 AllStr := inttobin(AddrArray[I].Addr,26);
                 TagStr := Copy(AllStr,1,x);
                 IndexStr := Copy(AllStr,x+1,y);
                 Tagint := bintoint(TagStr);
                 Indexint := bintoint(IndexStr);
                 match := False;
                 NotFull := False;
                 for J := Indexint*n+0 to Indexint*n+n-1 do
                   begin
                           if(MLBArray[J].tag = Tagint)and
                             (MLBArray[J].YXW = True)then
                            begin
                                match := True;
                                HCount := HCount+1;
                                MLBArray[J].TimeStrRec := TimeToStr(Time);
                                AddrArray[I].Hit := True;
                                break;
                            end;
                        if MLBArray[J].tag = -1 then
                               NotFull := True;
                    end;
                 if match = False then
                    begin
                       if NotFull = True then
                          begin
                             for K := Indexint*n+0 to Indexint*n+n-1 do
                                 if MLBArray[K].tag = -1 then
                                    begin
                                        
                                      MLBArray[K].tag := Tagint;
                                      MLBArray[K].TimeStrIn 
                                                 := TimeToStr(Time);
                                      MLBArray[K].TimeStrRec 
                                                 := MLBArray[K].TimeStrIn;
                                      break;
                                    end;
                          end;
                       if NotFull = False then
                          begin
                             if Swap = 1 then
                                begin
                                   Swapint := Indexint*n+Random(n);
                                end;
                             if Swap = 2 then
                                begin
                                   TimeStrFirIn := TimeToStr(Time);
                                   for K:= Indexint*n+0 to Indexint*n+n-1 do
               if AnsiCompareText(MLBArray[K].TimeStrIn,TimeStrFirIn)<0 then
                                             begin
                                                TimeStrFirIn 
                                                := MLBArray[K].TimeStrIn;
                                                Swapint := K;
                                             end;                            end;
                             if Swap = 3 then
                                begin
                                   TimeStrLRU := TimeToStr(Time);
                                   for K:= Indexint*n+0 to Indexint*n+n-1 do
                if AnsiCompareText(MLBArray[K].TimeStrRec,TimeStrLRU)<0 then
                                            begin
                                              TimeStrLRU 
                                              := MLBArray[K].TimeStrRec;
                                              Swapint := K;
                                            end;
                                end;
                             
                             MLBArray[Swapint].tag := Tagint;
                             MLBArray[Swapint].TimeStrIn := TimeToStr(Time);
                             MLBArray[Swapint].TimeStrRec 
                             := MLBArray[Swapint].TimeStrIn;
                          end;
                    end;           end;      end;   HaveRun := True;
       HitStatistic();
       ComputeRes();
       InfStr := '模拟完成,请通过ViewResult菜单查看模拟结果!';
       MessageDlg(InfStr,mtInformation,[mbOK],0);end;
    谢谢
      

  6.   

    我一步一步的设置了SHowMessage('Come to here');
    不过有好多种可能,
      

  7.   

    好多地方跟
    TimeStrIn : string;{调入时间字符串}
    TimeStrRec : string;{最近访问时间字符串}的赋值、比较有关
      

  8.   

    为何不将TimeStrIn的类型改为TDataTime试试
      

  9.   

    单步我试过,因为要选择相应操作,不知为何一下子就到end.处了
      

  10.   

    我在调一调,找出可能的错误告诉大家,大家再给我意见,谢谢,wait
      

  11.   


    我将TimeStrIn的类型改为TDataTime后,发现错误:Project Cache.exe raised exception class EInvalidOp with message 'Invalid 
    floating point operation'. Process stopped. Use Step or Run to continue.对应这行代码:
    if CompareDate(MLBArray[K].TimeRec,TimeLRU)=-1 then