Hello,
I just installed DENOMO and got a trace of several (potential) memory leaks in my multithreaded Indy9-based UDP server application. However, I haven't been able to figure out how to go about fixing them. Several of them seem to be in other units, so not much I can do about those, I guess. Since this server is supposed to run non-stop, memory leaks are a big deal. Any ideas? I am pasting some of the lines in the log as well as relevant code...
Checking final leak at Viernes, 24 de Abril de 2009 05:23:57 p.m.
00E74674 BlockSize: 20 Class: TObjectList
ST: 004471B6 [HelpIntfs] [THelpManager.Create] [295]
ST: 004470BD [HelpIntfs] [GetHelpSystem] [274]
ST: 004812F2 [Forms] [TApplication.ValidateHelpSystem] [7111]
ST: 0047EECE [Forms] [TApplication.Create] [6116]
ST: 00467163 [Controls] [InitControls] [10708]
ST: 004672C0 [Controls] [initialization] [10728]
ST: 004047B4 [System] [InitUnits] [10537]
ST: 0040481B [System] [@StartExe] [10614]
ST: 7C816FE7 [] [Unknown function at RegisterWaitForInputIdle] []
(Not sure I can do much about this. There are several THelpManager leaks just like this)
00E9E8BC BlockSize: 164 Class: TReportInfo
ST: 004F2B26 [main] [TfrmServer.ProcessPackage] [2854]
ST: 004EC169 [main] [TUdpThread.Execute] [1326]
ST: 00438EE7 [Classes] [ThreadProc] [9010]
ST: 00404AD6 [System] [ThreadWrapper] [11221]
ST: 7C80B699 [] [Unknown function at GetModuleFileNameA] []
(Now, this is likely to be a big deal. However, I can't figure out why this happens... this is the code...
DataTable:=TReportInfo.Create; //line 2854
Count:=length(data);
if( count> 0)then
begin
//do actual processing of DataTable object. No exit's or exceptions inside
end;
DataTable.Free;
so, I don't know how the memory is getting leaked)
00EA5BDC BlockSize: 24 Class: TIconImage
ST: 004457D5 [Graphics] [TIcon.SetHandle] [6616]
ST: 00469FE2 [ImgList] [TCustomImageList.GetIcon] [472]
ST: 00469F87 [ImgList] [TCustomImageList.GetIcon] [464]
ST: 004F4EFA [main] [TfrmServer.SetIcons] [3228]
ST: 004F1825 [main] [TfrmServer.tmrHeartbeatTimer] [2579]
ST: 0044F8C6 [ExtCtrls] [TTimer.Timer] [1621]
ST: 0044F734 [ExtCtrls] [TTimer.WndProc] [1578]
ST: 0043AAAE [Classes] [StdWndProc] [10566]
ST: 7E398734 [] [Unknown function at GetDC] []
ST: 7E398816 [] [Unknown function at GetDC] []
(The troublesome thing about this is that it is happening inside the GetIcon, which I have no control over. I am pasting the SetIcons code. This is getting called every minute to update the taskbar icon with the state of the server, so leaks here escalate...
while ilTray.Count>1 do
ilTray.Delete(1);
if icoOff then
begin
ico:=TIcon.Create;
ilIcons.GetIcon(0,ico);
ico:=CombineIcons(ico.Handle,application.Icon.Handle);
ilTray.AddIcon(ico);
end;
if icoRed then
begin
ico:=TIcon.Create; (*!*)
ilIcons.GetIcon(1,ico); (*!*)
ico:=CombineIcons(ico.Handle,application.Icon.Handle);
ilTray.AddIcon(ico);
end;
if icoYel then
begin
ico:=TIcon.Create;
ilIcons.GetIcon(2,ico);
ico:=CombineIcons(ico.Handle,application.Icon.Handle);
ilTray.AddIcon(ico);
end;
TrayIcon.IconIndex:=0;
TrayIcon.CycleIcons:=ilTray.Count>1;
)
(And, finally, not sure what this means exactly... 14 blocks?, eliminated leaks on 225 blocks? What does the count represent? How is this different from what is found before?)
Totally output 14 blocks 0 handles in 0 seconds.
Eliminated leaks on same calling path of 225 blocks.
The most places blocks on same calling path occurs in:
Same count: 224
ST: 004F2B26 [main] [TfrmServer.ProcessPackage] [2854]
ST: 004EC169 [main] [TUdpThread.Execute] [1326]
ST: 00438EE7 [Classes] [ThreadProc] [9010]
ST: 00404AD6 [System] [ThreadWrapper] [11221]
ST: 7C80B699 [] [Unknown function at GetModuleFileNameA] []
Same count: 1
ST: 0044F8C6 [ExtCtrls] [TTimer.Timer] [1621]
ST: 0044F734 [ExtCtrls] [TTimer.WndProc] [1578]
ST: 0043AAAE [Classes] [StdWndProc] [10566]
ST: 7E398734 [] [Unknown function at GetDC] []
ST: 7E398816 [] [Unknown function at GetDC] []
ST: 7E3989CD [] [Unknown function at GetWindowLongW] []
ST: 7E3996C7 [] [DispatchMessageA] []
ST: 004804BD [Forms] [TApplication.ProcessMessage] [6696]
ST: 00480504 [Forms] [TApplication.HandleMessage] [6715]
ST: 0048079F [Forms] [TApplication.Run] [6799]
Leaks found on program exit. Totallly 14 blocks 0 handles.
OK, hope someone can give me an idea on how to deal with this...
Thanks,
Arturo