sqlservr.exe内存利用不断增长。源代码如下...是代码的问题吗?
程序执行环境:
WindowsXP SP2,Windows2000Pro
SqlServer2000(中文版) 没有打补丁,谁知道下载地址,请告知,谢谢!在定时器里每秒执行查询数据表。
为什么sqlservr.exe不断增长,每次大约增长40k。
为什么会出现这种情况,怎样解决?我把定时器关了,就不出现这种情况了。
我想,应该还有这种情况,只是执行一次变化不大而已。数据集也关了,是代码的问题吗,还是SqlServer本身查询一次就会使用内存并不释放?//判断是否到了重启时间
function TFrmMain.IsRebootTime(HHMMSS: string): boolean;
begin
with data1.adocyc do
begin
close;
sql.Clear;
sql.Add(Format(cnSqlReboot, [HHMMSS]));
open;
if RecordCount = 1 then
begin
result := true;
end
else
begin
result := false;
end;
close;
end;
end;//定时器不断查询
procedure TFrmMain.Timer1Timer(Sender: TObject);
begin
//是否重启时间.
if IsRebootTime(FormatDateTime('HH:MM:SS', now)) then
begin
ReBoot() //重启
end;
end;
程序执行环境:
WindowsXP SP2,Windows2000Pro
SqlServer2000(中文版) 没有打补丁,谁知道下载地址,请告知,谢谢!在定时器里每秒执行查询数据表。
为什么sqlservr.exe不断增长,每次大约增长40k。
为什么会出现这种情况,怎样解决?我把定时器关了,就不出现这种情况了。
我想,应该还有这种情况,只是执行一次变化不大而已。数据集也关了,是代码的问题吗,还是SqlServer本身查询一次就会使用内存并不释放?//判断是否到了重启时间
function TFrmMain.IsRebootTime(HHMMSS: string): boolean;
begin
with data1.adocyc do
begin
close;
sql.Clear;
sql.Add(Format(cnSqlReboot, [HHMMSS]));
open;
if RecordCount = 1 then
begin
result := true;
end
else
begin
result := false;
end;
close;
end;
end;//定时器不断查询
procedure TFrmMain.Timer1Timer(Sender: TObject);
begin
//是否重启时间.
if IsRebootTime(FormatDateTime('HH:MM:SS', now)) then
begin
ReBoot() //重启
end;
end;
我在定时器里执行了同样的sql语句,sqlserver应该不会再分配查询记录的内存吧.为什么sqlservr.exe内存一直增长呢?
if RecordCount = 1 then
begin
result := true;
end
else
begin
result := false;
end;
可以改为一条语句:Result := RecordCount = 1;