delphi 7 做多线程程序,内存不断增加,怎么解决?
typeTmythread=class(TThread)private{Privatedeclarations}protectedprocedureExecute;ove...
type
Tmythread = class(TThread)
private
{ Private declarations }
protected
procedure Execute; override;
end;
procedure Tmythread.Execute;
var
s1,s2,ReadStr,sendstr:string; //ReadStr,
j,i,m,n:integer;
begin
readstr:=ReadS;
ReadS:='';
FreeOnTerminate:=true;
EnterCriticalSection(cs);
try
while trim(ReadStr)<>'' do
begin
i:=length(ReadStr);
s1:=leftstr(ReadStr,1);
j:=pos(';',ReadStr);
if (j>0) then
begin
s2:=leftstr(ReadStr,j);
case TypeList.IndexOf(s1) of
0:begin
Frm_ISMain.ReadSearch(s2);
end;
1:begin
//Frm_ISMain.ReadData(s2);
end;
2:begin
//Frm_ISMain.PowerChange(s2);
end;
else
break;
end;//case
if j=i then
ReadStr:=''
else if j<i then
ReadStr:=Rightstr(ReadStr,i-j);
end
else
break; //if
end; //while
Finally
LeaveCriticalSection(CS);
end;
end; 展开
Tmythread = class(TThread)
private
{ Private declarations }
protected
procedure Execute; override;
end;
procedure Tmythread.Execute;
var
s1,s2,ReadStr,sendstr:string; //ReadStr,
j,i,m,n:integer;
begin
readstr:=ReadS;
ReadS:='';
FreeOnTerminate:=true;
EnterCriticalSection(cs);
try
while trim(ReadStr)<>'' do
begin
i:=length(ReadStr);
s1:=leftstr(ReadStr,1);
j:=pos(';',ReadStr);
if (j>0) then
begin
s2:=leftstr(ReadStr,j);
case TypeList.IndexOf(s1) of
0:begin
Frm_ISMain.ReadSearch(s2);
end;
1:begin
//Frm_ISMain.ReadData(s2);
end;
2:begin
//Frm_ISMain.PowerChange(s2);
end;
else
break;
end;//case
if j=i then
ReadStr:=''
else if j<i then
ReadStr:=Rightstr(ReadStr,i-j);
end
else
break; //if
end; //while
Finally
LeaveCriticalSection(CS);
end;
end; 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询