Access Violation calling ReportLeaksNow

delphi package - automated exception handling
Post Reply
mri.mike
Posts: 3
Joined: Wed Apr 13, 2022 11:13 am

Access Violation calling ReportLeaksNow

Post by mri.mike »

I'm trying to use the ReportLeaksNow function in a Delphi 7 application. As a test I've created a new application, added a button and the following code:

procedure TForm1.btn1Click(Sender: TObject);
begin
TStringList.Create;
ReportLeaksNow(True);
end;

madExcept has been enabled and report resource leaks is turned on.

When I click the button I see the "Creating Leak Report" message, but I then get the madExcept bug report shown below.

Am I doing something wrong?

Mike

date/time : 2022-04-13, 15:46:36, 92ms
computer name : XXXXXXX
user name : Mike.Bennett
registered owner : Windows User
operating system : Windows 10 x64 build 19044
system language : English
system up time : 7 hours 23 minutes
program up time : 9 seconds
processors : 8x Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
physical memory : 3086/16202 MB (free/total)
free disk space : (C:) 59.21 GB
display mode : 1536x864, 32 bit
process id : $56dc
allocated memory : 90.22 MB
largest free block : 1.24 GB
executable : LeakTest.exe
current module : madExcept32.dll
module date/time : 2015-09-10 13:54
version : 4.0.5.0
compiled with : Delphi XE2 --- This is odd as I'm using Delphi 7
madExcept version : 4.0.12
callstack crc : $77adf3a1, $e80272f0, $e80272f0
exception number : 1
exception class : EAccessViolation
exception message : Access violation at address 77ADF3A1 in module 'ntdll.dll'. Read of address 07DBFE28.

thread $5fac:
77adf3a1 +007b ntdll.dll
77abe7cd +008d ntdll.dll RtlLeaveCriticalSection
671dd630 +38a8 madExcept32.dll madExceptDbg 7855 +817 CreateLeakReport
671e0686 +00ae madExcept32.dll madExceptDbg 8453 +12 ReportLeaksNow
0045fe5f +0033 LeakTest.exe madExcept ReportLeaksNow
004afaa2 +000e LeakTest.exe Main 32 +1 TForm1.btn1Click
004901c0 +0064 LeakTest.exe Controls TControl.Click
00488914 +001c LeakTest.exe StdCtrls TButton.Click
00488a08 +000c LeakTest.exe StdCtrls TButton.CNCommand
00490028 +0188 LeakTest.exe Controls TControl.WndProc
00492f73 +0157 LeakTest.exe Controls TWinControl.WndProc
004887d8 +006c LeakTest.exe StdCtrls TButtonControl.WndProc
0048fdf8 +0024 LeakTest.exe Controls TControl.Perform
004930ab +0023 LeakTest.exe Controls DoControlMsg
00493703 +000b LeakTest.exe Controls TWinControl.WMCommand
004a9da8 +002c LeakTest.exe Forms TCustomForm.WMCommand
00490028 +0188 LeakTest.exe Controls TControl.WndProc
00492f73 +0157 LeakTest.exe Controls TWinControl.WndProc
004a7df9 +0421 LeakTest.exe Forms TCustomForm.WndProc
00492bf0 +002c LeakTest.exe Controls TWinControl.MainWndProc
00477ce4 +0014 LeakTest.exe Classes StdWndProc
77735a7a +006a user32.dll SendMessageW
77724246 +0016 user32.dll CallWindowProcA
00493057 +00d7 LeakTest.exe Controls TWinControl.DefaultHandler
004905c8 +0010 LeakTest.exe Controls TControl.WMLButtonUp
00490028 +0188 LeakTest.exe Controls TControl.WndProc
00492f73 +0157 LeakTest.exe Controls TWinControl.WndProc
004887d8 +006c LeakTest.exe StdCtrls TButtonControl.WndProc
00492bf0 +002c LeakTest.exe Controls TWinControl.MainWndProc
00477ce4 +0014 LeakTest.exe Classes StdWndProc
77727f5b +000b user32.dll DispatchMessageA
004ae153 +0083 LeakTest.exe Forms TApplication.ProcessMessage
004ae172 +000a LeakTest.exe Forms TApplication.HandleMessage
004ae3a2 +0096 LeakTest.exe Forms TApplication.Run
004afe17 +003b LeakTest.exe LeakTest 17 +3 initialization
7762fa27 +0017 KERNEL32.DLL BaseThreadInitThunk

thread $70f4:
7762fa27 +17 KERNEL32.DLL BaseThreadInitThunk

thread $6e20:
7762fa27 +17 KERNEL32.DLL BaseThreadInitThunk

thread $7054:
7762fa27 +17 KERNEL32.DLL BaseThreadInitThunk

thread $2c90:
7762fa27 +17 KERNEL32.DLL BaseThreadInitThunk

thread $1a3c:
7762fa27 +17 KERNEL32.DLL BaseThreadInitThunk

modules:
00400000 LeakTest.exe C:\TFS\Planet\Delphi\Tools\LeakTest
5a090000 wsock32.dll 6.2.19041.1 C:\WINDOWS\SYSTEM32
5ace0000 CoreMessaging.dll 6.2.19041.867 C:\WINDOWS\System32
5ad80000 CoreUIComponents.dll 6.2.19041.546 C:\WINDOWS\System32
5b000000 textinputframework.dll 6.2.19041.1503 C:\WINDOWS\SYSTEM32
66b10000 TextShaping.dll C:\WINDOWS\SYSTEM32
67100000 madExcept32.dll 4.0.5.0 C:\Program Files (x86)\madCollection\madExcept\Dlls
69a40000 dbghelp.dll 6.2.19041.1052 C:\WINDOWS\SYSTEM32
69cb0000 dbgcore.DLL 6.2.19041.546 C:\WINDOWS\SYSTEM32
69f00000 comctl32.DLL 6.10.19041.1110 C:\WINDOWS\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.19041.1110_none_a8625c1886757984
6a7f0000 wintypes.dll 6.2.19041.1348 C:\WINDOWS\SYSTEM32
6ca50000 propsys.dll 7.0.19041.1023 C:\WINDOWS\system32
726f0000 SspiCli.dll 6.2.19041.1586 C:\WINDOWS\SYSTEM32
729a0000 winspool.drv 6.2.19041.1566 C:\WINDOWS\SYSTEM32
72c50000 uxtheme.dll 6.2.19041.1566 C:\WINDOWS\system32
72cd0000 comctl32.dll 5.82.19041.1110 C:\WINDOWS\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.19041.1110_none_c0da534e38c01f4d
72d70000 ntmarta.dll 6.2.19041.546 C:\WINDOWS\SYSTEM32
74710000 Wldp.dll 6.2.19041.1566 C:\WINDOWS\SYSTEM32
74740000 windows.storage.dll 6.2.19041.1566 C:\WINDOWS\SYSTEM32
75660000 version.dll 6.2.19041.546 C:\WINDOWS\SYSTEM32
75940000 kernel.appcore.dll 6.2.19041.546 C:\WINDOWS\SYSTEM32
75950000 SHLWAPI.dll 6.2.19041.1023 C:\WINDOWS\System32
759a0000 oleaut32.dll 6.2.19041.985 C:\WINDOWS\System32
75aa0000 bcryptPrimitives.dll 6.2.19041.1415 C:\WINDOWS\System32
75b00000 MSCTF.dll 6.2.19041.1566 C:\WINDOWS\System32
75be0000 RPCRT4.dll 6.2.19041.1466 C:\WINDOWS\System32
75ca0000 WS2_32.dll 6.2.19041.546 C:\WINDOWS\System32
75d10000 shell32.dll 6.2.19041.1566 C:\WINDOWS\System32
762f0000 GDI32.dll 6.2.19041.1202 C:\WINDOWS\System32
76320000 gdi32full.dll 6.2.19041.1566 C:\WINDOWS\System32
76460000 ucrtbase.dll 6.2.19041.789 C:\WINDOWS\System32
76580000 combase.dll 6.2.19041.1566 C:\WINDOWS\System32
76800000 shcore.dll 6.2.19041.1566 C:\WINDOWS\System32
76890000 sechost.dll 6.2.19041.1586 C:\WINDOWS\System32
76930000 ole32.dll 6.2.19041.1202 C:\WINDOWS\System32
76a20000 IMM32.DLL 6.2.19041.546 C:\WINDOWS\System32
76a50000 clbcatq.dll 2001.12.10941.16384 C:\WINDOWS\System32
76ad0000 KERNELBASE.dll 6.2.19041.1586 C:\WINDOWS\System32
76d10000 comdlg32.dll 6.2.19041.1566 C:\WINDOWS\System32
76f10000 advapi32.dll 6.2.19041.1466 C:\WINDOWS\System32
76f90000 msvcp_win.dll 6.2.19041.789 C:\WINDOWS\System32
775c0000 CFGMGR32.dll 6.2.19041.1151 C:\WINDOWS\System32
77610000 KERNEL32.DLL 6.2.19041.1566 C:\WINDOWS\System32
77700000 user32.dll 6.2.19041.1586 C:\WINDOWS\System32
778a0000 win32u.dll 6.2.19041.1586 C:\WINDOWS\System32
779b0000 msvcrt.dll 7.0.19041.546 C:\WINDOWS\System32
77a80000 ntdll.dll 6.2.19041.1566 C:\WINDOWS\SYSTEM32
78620000 FaultRep.dll 6.2.19041.1566 C:\WINDOWS\SYSTEM32
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: Access Violation calling ReportLeaksNow

Post by madshi »

I've just tested this here on Delphi 7 and it works fine for me. Here's my test project:

http://madshi.net/d7leakTest.zip

Does this EXE, compiled by me, produce the same crash you're getting? If not, please simply delete the EXE and recompile. Does it crash then? If not, delete all DCUs etc and recompile. Does it crash then?
mri.mike
Posts: 3
Joined: Wed Apr 13, 2022 11:13 am

Re: Access Violation calling ReportLeaksNow

Post by mri.mike »

Hi

Your exe works fine. If I delete it and recompile I then get an Access Violation when I click the button. Compiling has regenerated Unit1.dcu.

Mike
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: Access Violation calling ReportLeaksNow

Post by madshi »

Is it possible you might not have the Delphi 7 update pack installed? I don't recall the details, but I think there was one? Also, I assume you're using the latest madExcept 5 build?
mri.mike
Posts: 3
Joined: Wed Apr 13, 2022 11:13 am

Re: Access Violation calling ReportLeaksNow

Post by mri.mike »

Upgrading to madExcept 5.1.2 has fixed the problem.

Thanks

Mike
Post Reply