问题一!!!
我使用Delphi 6 提供的TTcpServer编写程序:
使用如下的代码初始化TTcpServer,
//设置SGIP接收服务器的本地监听IP和端口
Server.LocalHost := '192.168.0.99';
Server.LocalPort := IntToStr( Port );
TTcpServer对象是动态创建的,然后使用如下的代码打开TTcpServer
Result := False;
Try
Server.Open;
Result := True;
Except
End;
使用如下的代码关闭TTcpServer
Result := False;
Try
Server.Close;
Result := True;
Except
End;
并且保证100%释放了手工创建的TTcpServer对象,但是出现了以下的问题:
使用内存漏洞检测工具CodeWatch进行检测,发现产生了72+16共88个字节的内存漏洞,一个Socket资源漏洞,一个线程句柄漏洞。发生这些漏洞的位置都是在调用TTcpServer的Open方法,好像Close方法和Free不能正确地处理TTcpServer自己分配内存和资源(我的理解),请高手帮忙解释为什么能够导致这种现象!!!