The reason that your DLL is not reporting leaks stems from this code in the FastMM shutdown:
CheckBlocksOnShutdown(
{$ifdef EnableMemoryLeakReporting}
True
{$ifdef RequireIDEPresenceForLeakReporting}
and DelphiIsRunning
{$endif}
{$ifdef RequireDebuggerPresenceForLeakReporting}
and ((DebugHook <> 0)
{$ifdef PatchBCBTerminate}
or (Assigned(pCppDebugHook) and (pCppDebugHook^ <> 0))
{$endif PatchBCBTerminate}
)
{$endif}
{$ifdef ManualLeakReportingControl}
and ReportMemoryLeaksOnShutdown
{$endif}
{$else}
False
{$endif}
);
In your options, RequireDebuggerPresenceForLeakReporting
is defined. What's more, in the DLL, DebugHook
is equal to 0
, presumably because you are debugging the application rather than the DLL. This means that you call CheckBlocksOnShutdown
passing False
. And that False
disables reporting of leaks.
You can resolve this by undefining RequireDebuggerPresenceForLeakReporting
.