Indy 10 TIdTCPClient导致内存泄漏
在Form上放一个TIdTCPClient控件,在IDE环境中运行程序,然后退出程序,提示28字节的内存没有释放,消息如下
2008-7-18 13:38:03 started a CodeGuard(tm) process: Client.exe(3312)
Resource leak in process: TigerClient.exe(3312) - sys\system.pas#2655
The memory block (0x12151A0) was never freed
The memory block (0x012151A0) [size: 28 bytes] was allocated with SysGetMem
0x004A7D6A - sys\system.pas#2655
0x00641299
0x0064146F
如果拿掉 TIdTCPClient控件,则没有问题
[解决办法]
断开前释放InputBuffer
if (IdTCPClient1->IOHandler->InputBuffer->Size)
IdTCPClient1->IOHandler->InputBuffer->Clear();
IdTCPClient1->IOHandler->CloseGracefully();
IdTCPClient1->Disconnect();
[解决办法]
是不是最新版本的INDY10?如果不是的话,建议更新一下。
[解决办法]