Euraklog中的multi free memroy leak(100)

  • 主题发起人 主题发起人 diligentcat
  • 开始时间 开始时间
D

diligentcat

Unregistered / Unconfirmed
GUEST, unregistred user!
代码有点长,麻烦各位了。procedure TfrmGraphi.BitBtn1Click(Sender: TObject);var re1:trichedit; sql:string; tmpstr,datatohtmlstr:string; str:string; i:integer; //missstr:string; //近五期中奖号码 fiveprizeNum:TArrPrizeNumMiss; tenprizenum:TArrPrizeNumMiss; //临时存储中奖号码中遗漏从0-5的个数 tmpmissnum: TArrPrizeNumMiss; tmpmissnum1:TRecNumMiss; j: Integer; m: Integer; Issame:boolean; frmp:tfrmprocessbar; aquery,bquery:tadoquery;begin datatohtmlstr:=''; //数字区间偏差追踪系统 self.pb1.Min:=0; self.pb1.max:=100; self.pb1.Position:=0; self.pb1.Visible:=true; {sql:='select top 10 * from prize where issue<='+combobox3.Text+' order by issue desc '; untsys.Exesqlquery(sql,aquery); } tmpstr:=Self.CreateZoneStat; re1:=trichedit.create(nil); re1.Visible:=false; re1.Parent:=self; re1.PlainText:=true; re1.Clear; re1.Lines.Add(htmltablefront1+'数字区间统计表'+htmltablefront2+ tmpstr+htmltabletrail); re1.Lines.SaveToFile(syspath+'lottery1.html',TEncoding.Unicode); webbrowser2.Navigate(syspath+'lottery1.html'); // self.pb1.Position:=20; // self.refresh; if combobox3.Text<>'' then begin sql:='select * from prize where issue='+combobox3.Text; untsys.Exesqlquery(sql,aquery); Label6.Caption:='第'+combobox3.text+'的抽奖结果为:'+inttostr(aquery.fieldbyname('1').asinteger)+'-'+ inttostr(aquery.fieldbyname('2').asinteger)+ '-' + inttostr(aquery.fieldbyname('3').asinteger)+ '-'+ inttostr(aquery.fieldbyname('4').asinteger)+ '-'+ inttostr(aquery.fieldbyname('5').asinteger)+ '-'+ inttostr(aquery.fieldbyname('6').asinteger)+ '---'+ inttostr(aquery.fieldbyname('7').asinteger); aquery.Free; end; //遗漏数字偏差追踪系统 //近五期 setlength(fiveprizenum,6); SetLength(tmpmissnum,6); datatohtmlstr:=datatohtmlstr+self.CreateLostNumStat('近五期中奖号码遗漏统计表', 5,fiveprizeNum,tmpmissnum ); for i := 0 to length(fiveprizenum) - 2 do for j := i+1 to length(fiveprizenum)-1 do begin if fiveprizenum.number>fiveprizenum[j].number then begin tmpmissnum1:=fiveprizenum; fiveprizenum:=fiveprizenum[j]; fiveprizenum[j]:=tmpmissnum1; end; end; datatohtmlstr:=datatohtmlstr+'
前五期中奖的号码有:'; for i := 0 to length(fiveprizenum) - 1 do begin datatohtmlstr:=datatohtmlstr+inttostr(fiveprizenum.number)+' ' ; end; datatohtmlstr:=datatohtmlstr+'
共:'+inttostr(length(fiveprizenum))+'个'; //近六期 //setlength(fiveprizenum,6); SetLength(tmpmissnum,7); datatohtmlstr:=datatohtmlstr+self.CreateLostNumStat('近六期中奖号码遗漏统计表', 6,fiveprizeNum,tmpmissnum ); //近七期 self.pb1.Position:=50; //setlength(fiveprizenum,6); SetLength(tmpmissnum,8); datatohtmlstr:=datatohtmlstr+self.CreateLostNumStat('近七期中奖号码遗漏统计表', 7,fiveprizeNum,tmpmissnum ); //近八期 //setlength(fiveprizenum,6); SetLength(tmpmissnum,9); datatohtmlstr:=datatohtmlstr+self.createLostNumStat('近八期中奖号码遗漏统计表', 8,fiveprizeNum,tmpmissnum ); //近九期 self.pb1.Position:=80; //setlength(fiveprizenum,6); SetLength(tmpmissnum,10); datatohtmlstr:=datatohtmlstr+self.CreateLostNumStat('近九期中奖号码遗漏统计表', 9,fiveprizeNum,tmpmissnum ); //近十期 //SetLength(fiveprizeNum,6); SetLength(tmpmissnum,11); datatohtmlstr:=datatohtmlstr+self.CreateLostNumStat('近十期中奖号码遗漏统计表',10,fiveprizeNum,tmpmissnum); re1.Lines.Clear; re1.Lines.Add(htmltablefront1+'遗漏数字统计表'+htmltablefront2+ datatohtmlstr+ htmltabletrail); re1.Lines.SaveToFile(syspath+'lottery3.html',TEncoding.Unicode); webbrowser3.Navigate(syspath+'lottery3.html'); datatohtmlstr:=''; //末位数字偏差追踪系统 SetLength(fiveprizeNum,6); SetLength(tmpmissnum,10); datatohtmlstr:=datatohtmlstr+self.CreateLastNumStat('近五期末位数字偏差统计表',5,fiveprizeNum,tmpmissnum); SetLength(fiveprizeNum,6); SetLength(tmpmissnum,10); datatohtmlstr:=datatohtmlstr+self.CreateLastNumStat('近六期末位数字偏差统计表',6,fiveprizeNum,tmpmissnum); SetLength(fiveprizeNum,6); SetLength(tmpmissnum,10); datatohtmlstr:=datatohtmlstr+self.CreateLastNumStat('近七期末位数字偏差统计表',7,fiveprizeNum,tmpmissnum); SetLength(fiveprizeNum,6); SetLength(tmpmissnum,10); datatohtmlstr:=datatohtmlstr+self.CreateLastNumStat('近八期末位数字偏差统计表',8,fiveprizeNum,tmpmissnum); SetLength(fiveprizeNum,6); SetLength(tmpmissnum,10); datatohtmlstr:=datatohtmlstr+self.CreateLastNumStat('近九期末位数字偏差统计表',9,fiveprizeNum,tmpmissnum); SetLength(fiveprizeNum,6); SetLength(tmpmissnum,10); datatohtmlstr:=datatohtmlstr+self.CreateLastNumStat('近十期末位数字偏差统计表',10,fiveprizeNum,tmpmissnum); self.pb1.Position:=100; self.refresh; self.pb1.Visible:=false; re1.Clear; re1.Lines.Add(htmltablefront1+'末位数字偏差统计表'+htmltablefront2+ datatohtmlstr+ htmltabletrail); re1.Lines.SaveToFile(syspath+'lottery4.html',TEncoding.Unicode); wb1.Navigate(syspath+'lottery4.html'); re1.Free;end;function TfrmGraphi.CreateLostNumStat(title:string;Num: integer;var fiveprizenum:TArrPrizeNumMiss; var tmpmissnum:TArrPrizeNumMiss ): string;var issame:boolean; i,j,m:integer; tmpmissnum1:TRecNumMiss; datatohtmlstr:string; str:string; aquery:tadoquery;begin issame:=false; //选出近Num期中奖号码 untsys.Exesqlquery('select top '+inttostr(Num)+' * from prize order by issue desc',aquery); aquery.First; fiveprizenum[0].number:=aquery.FieldByName('1').Value; fiveprizenum[1].number:=aquery.FieldByName('2').Value; fiveprizenum[2].number:=aquery.FieldByName('3').Value; fiveprizenum[3].number:=aquery.FieldByName('4').Value; fiveprizenum[4].number:=aquery.FieldByName('5').Value; fiveprizenum[5].number:=aquery.FieldByName('6').Value; aquery.Next; for m := 0 to aquery.RecordCount - 2 do begin for j := 1 to 6 do begin issame:=false; for i := 0 to length(fiveprizenum)-1 do begin if fiveprizenum.number=aquery.FieldByName(inttostr(j)).Value then begin issame:=true; break; end; end; // end for i //添加中奖号码 if issame=false then begin setlength(fiveprizenum,length(fiveprizenum)+1); fiveprizenum[length(fiveprizenum)-1].number:=aquery.FieldByName(inttostr(j)).AsInteger; end; //end if issame end; //end for j aquery.Next; end; //end for m aquery.Free; //--------------------------------------------------------------------------------- //查询各中奖号码的遗漏值 untsys.Exesqlquery('select * from missvalue',aquery); for i := 0 to length(fiveprizenum)-1 do begin fiveprizenum.MissMany:=aquery.FieldByName('red'+inttostr(fiveprizenum.number)).Value; end; aquery.Free; for i := 0 to length(tmpmissnum)-1 do begin tmpmissnum.number:=0; tmpmissnum.MissMany:=i; end; //此处为了省事儿,用了同一个记录,只是为了排序输出 number为遗漏值为n的个数 for i := 0 to length(fiveprizenum) - 1 do begin case fiveprizenum.MissMany of 0: begin tmpmissnum[0].number:= tmpmissnum[0].number+1; //ShowMessage(IntToStr(fiveprizenum.number)+':'+inttostr(fiveprizenum.MissMany)+':'+inttostr(tmpmissnum[0].number)); end; 1: begin tmpmissnum[1].number:= tmpmissnum[1].number+1; //ShowMessage(IntToStr(fiveprizenum.number)+':'+inttostr(fiveprizenum.MissMany)+':'+inttostr(tmpmissnum[1].number)); end; 2: begin tmpmissnum[2].number:= tmpmissnum[2].number+1; // ShowMessage(IntToStr(fiveprizenum.number)+':'+inttostr(fiveprizenum.MissMany)+':'+inttostr(tmpmissnum[2].number)); end; 3: begin tmpmissnum[3].number:= tmpmissnum[3].number+1; //ShowMessage(IntToStr(fiveprizenum.number)+':'+inttostr(fiveprizenum.MissMany)+':'+inttostr(tmpmissnum[3].number)); end; 4: begin tmpmissnum[4].number:= tmpmissnum[4].number+1; //ShowMessage(IntToStr(fiveprizenum.number)+':'+inttostr(fiveprizenum.MissMany)+':'+inttostr(tmpmissnum[4].number)); end; 5: begin tmpmissnum[5].number:= tmpmissnum[5].number+1; //ShowMessage(IntToStr(fiveprizenum.number)+':'+inttostr(fiveprizenum.MissMany)+':'+inttostr(tmpmissnum[5].number)); end; 6: begin tmpmissnum[6].number:= tmpmissnum[6].number+1; //ShowMessage(IntToStr(fiveprizenum.number)+':'+inttostr(fiveprizenum.MissMany)+':'+inttostr(tmpmissnum[6].number)); end; 7: begin tmpmissnum[7].number:= tmpmissnum[7].number+1; //ShowMessage(IntToStr(fiveprizenum.number)+':'+inttostr(fiveprizenum.MissMany)+':'+inttostr(tmpmissnum[7].number)); end; 8: begin tmpmissnum[8].number:= tmpmissnum[8].number+1; //ShowMessage(IntToStr(fiveprizenum.number)+':'+inttostr(fiveprizenum.MissMany)+':'+inttostr(tmpmissnum[8].number)); end; 9: begin tmpmissnum[9].number:= tmpmissnum[9].number+1; //ShowMessage(IntToStr(fiveprizenum.number)+':'+inttostr(fiveprizenum.MissMany)+':'+inttostr(tmpmissnum[9].number)); end; 10: begin tmpmissnum[10].number:= tmpmissnum[10].number+1; //ShowMessage(IntToStr(fiveprizenum.number)+':'+inttostr(fiveprizenum.MissMany)+':'+inttostr(tmpmissnum[10].number)); end; end; end; //排序按符合条件个数降序排列 //ShowMessage(IntToStr(Length(tmpmissnum))); for i := 0 to length(tmpmissnum) - 2 do for j := i+1 to length(tmpmissnum)-1 do//此处需要注意j=i+1 begin if (tmpmissnum.number>tmpmissnum[j].number) or((tmpmissnum.number=tmpmissnum[j].number) and (tmpmissnum.MissMany>tmpmissnum[j].MissMany))then begin //UNTMAIN.FrmMain.Memo1.Lines.Add(IntToStr(tmpmissnum.number)+':'+IntToStr(tmpmissnum.MissMany)); {tmpmissnum1.number:=tmpmissnum.number; tmpmissnum1.MissMany:=tmpmissnum.MissMany; tmpmissnum.number:=tmpmissnum[j].number; tmpmissnum.MissMany:=tmpmissnum[j].MissMany; tmpmissnum[j].number:=tmpmissnum1.number; tmpmissnum[j].MissMany:=tmpmissnum1.MissMany; } tmpmissnum1:=tmpmissnum; tmpmissnum:=tmpmissnum[j]; tmpmissnum[j]:=tmpmissnum1; //ShowMessage(IntToStr(tmpmissnum.number)+':'+inttostr(tmpmissnum.missmany)+'<->'+ //IntToStr(tmpmissnum[j].number)+':'+inttostr(tmpmissnum[j].missmany)); end ; end; {for i := 0 to Length(tmpmissnum )- 2 do begin for j := i+1 to Length(tmpmissnum) - 1 do begin if (tmpmissnum.number>tmpmissnum[j].number) and (tmpmissnum.MissMany=tmpmissnum[j].missmany) then begin tmpmissnum1:=tmpmissnum; tmpmissnum:=tmpmissnum[j]; tmpmissnum[j]:=tmpmissnum1; end; end; end; } datatohtmlstr:='<strong>'+title+'</strong><table bgcolor="#666666" width="100%" border="0" align="center" cellpadding="5" cellspacing="1"> '+ '<tr> '+ ' <td width="132" align="center" bgcolor="#CCCCCC">遗漏次数</td> '+ ' <td width="143" align="center" bgcolor="#CCCCCC">在过去'+inttostr(num)+'期中符合条件的数字个数</td>'+ ' <td width="417" align="center" bgcolor="#CCCCCC">符合条件的数字</td> '+ ' </tr> ' ; for i := 0 to num do begin str:=''; untsys.Exesqlquery('select * from missvalue',aquery); for j := 1 to 33 do begin if tmpmissnum.MissMany=aquery.FieldByName('red'+inttostr(j)).value then str:=str+','+inttostr(j); end; //showmessage(inttostr(tmpmissnum.number)+':'+inttostr(tmpmissnum.MissMany)); datatohtmlstr:=datatohtmlstr+'<tr>'+ ' <td bgcolor="#FFFFFF">'+inttostr(tmpmissnum.missmany)+'</td>'+ '<td bgcolor="#FFFFFF">'+inttostr(tmpmissnum.number)+'</td> '+ '<td bgcolor="#FFFFFF">'+str+'</td>'+ '</tr>'; aquery.Free; end; datatohtmlstr:=datatohtmlstr+'</table>'; result:=datatohtmlstr;end;单击按钮运行时,eruaklog 开始出现"memory overrun leak"异常,然后是"multi free memory leak"异常。百思不得其解。三天了,一点眉目也没有……
 
后退
顶部