I have a Delphi ISAPI DLL application that loads my actual web applications as package (BPL) files at runtime.
I’d like to report memory leaks in my packages when the ISAPI DLL unloads. However I don’t see the memory leak I intentionally added to my application even though I watch it get created in the debugger. Suggestions?
Here is the ISAPI DLL code:
library gISAPI;
uses
ShareMem,
Winapi.ActiveX,
System.Win.ComObj,
Web.WebBroker,
Web.Win.ISAPIApp,
Web.Win.ISAPIThreadPool,
ugISAPI in 'ugISAPI.pas' {WebModule1: TWebModule}
;
{$R *.res}
exports
GetExtensionVersion,
HttpExtensionProc,
TerminateExtension;
begin
// uncomment the next line to report memory leaks
ReportMemoryLeaksOnShutdown := True;
CoInitFlags := COINIT_MULTITHREADED;
Application.Initialize;
Application.WebModuleClass := WebModuleClass;
Application.Run;
end.
My application package looks like this:
package pGoog;
{$R *.res}
{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users}
{$ALIGN 8}
{$ASSERTIONS ON}
{$BOOLEVAL OFF}
{$DEBUGINFO OFF}
{$EXTENDEDSYNTAX ON}
{$IMPORTEDDATA ON}
{$IOCHECKS ON}
{$LOCALSYMBOLS ON}
{$LONGSTRINGS ON}
{$OPENSTRINGS ON}
{$OPTIMIZATION OFF}
{$OVERFLOWCHECKS ON}
{$RANGECHECKS ON}
{$REFERENCEINFO ON}
{$SAFEDIVIDE OFF}
{$STACKFRAMES ON}
{$TYPEDADDRESS OFF}
{$VARSTRINGCHECKS ON}
{$WRITEABLECONST OFF}
{$MINENUMSIZE 1}
{$IMAGEBASE $400000}
{$DEFINE DEBUG}
{$ENDIF IMPLICITBUILDING}
{$IMPLICITBUILD ON}
requires
rtl,
pGCore;
contains
Goog in 'Goog.pas';
end.
And my source file looks like this:
unit Goog;
interface
uses
ShareMem
, gPersistence
, gBase
;
{... code removed for example ...}
implementation
function TTrack.GetHasVideo: boolean;
begin
// create an unneeded track to cause a memory leak
{ TODO : Remove after testing memory leak detection }
var Track := TTrack.Create;
if assigned(Track) then
Result := not YouTubeID.IsEmpty
else
Result := false;
end;
{... code removed for example ...}