Utilizing TIdHttpServer and MadExcept in a Delphi 11 64-bit app, every time I close the app, with MadExcept set to report "Resource Leaks", I get two leaks, both with TIdCriticalSection in IdThreadSafe.pas and TCriticalSection in SyncObjs.pas.
This has all of the hallmarks of a "false flag" leak - i.e. MadExcept is reporting a leak that in reality doesn't exist. But I have to be sure.
Utilizing the old "ReportMemoryLeaksOnShutdown := True" does not report these 2 leaks...
Does anyone else see this?
Thanks.
CodePudding user response:
Yes, they are actual leaks, and yes, this is intentional behavior. See the comments at the bottom of Indy's IdThread.pas
and IdStack.pas
units.
That being said, they are registered leaks, so they should not appear in leak reports. In Delphi 2006 . System.RegisterExpectedMemoryLeak()
is used, so if MadExcept hooks into the RTL properly (ie, provides a TMemoryManagerEx.RegisterExpectedMemoryLeak
callback), it should pick up the registrations automatically.
Otherwise, for earlier versions, you can recompile Indy with USE_MADEXCEPT
(or USE_FASTMM4
, or USE_LEAKCHECK
) defined in IdCompilerDefines.inc
to enable leak registrations.
Otherwise, you can recompile Indy with FREE_ON_FINAL
defined in IdCompilerDefines.inc
to plug the leaks.