Unable to detect resource leak in X64 VCL app

delphi package - automated exception handling
spanfkyous
Posts: 13
Joined: Fri Nov 10, 2017 1:29 am

Unable to detect resource leak in X64 VCL app

Post by spanfkyous »

reproduce:

Create a VCL app, add windows 64 bit platform and switch to x64 platform.

Add this code:

procedure TForm1.FormCreate(Sender: TObject);
begin
allocmem(1000)
end;

Enable aadExcept, check report resource leak on

Run app and close it, nothing happened.

Tested on Delphi 10.2.3 and 10.1 with madCollection 2.8.4.0 and 2.8.4.10
The resource leak report works fine with 32 bit VCL app.
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Unable to detect resource leak in X64 VCL app

Post by madshi »

Unfortunately leak reporting and "instantly crash on buffer overrun" is limited to 32bit by design, I'm sorry.

I plan to make it available for 64bit with madExcept 5.0. No ETA yet, though.
spanfkyous
Posts: 13
Joined: Fri Nov 10, 2017 1:29 am

Re: Unable to detect resource leak in X64 VCL app

Post by spanfkyous »

Hi,

I tested the madexcept x64 in madCollection 2.8.8.0,
on my desktop, leak reporting is still not working for X64 VCL app, while the same setting works for X86 VCL app.
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Unable to detect resource leak in X64 VCL app

Post by madshi »

Did you install madExcept 4 or 5? Leak reporting in x64 only works with madExcept 5. If you have a valid madExcept 4 license, but not a 5 license yet, the installer will by default preselect madExcept 4. So there's a good chance you're still using madExcept 4, maybe?
spanfkyous
Posts: 13
Joined: Fri Nov 10, 2017 1:29 am

Re: Unable to detect resource leak in X64 VCL app

Post by spanfkyous »

Yes, my license is out of date,
First, i install madExcept 5.0.0 directlly and got nothing on Rio,
so i uninstalled the madExcept 4 and reinstalled madExcept 5 again without license

the result is: madExcept 5.0.0 leak reporting works on 32bit app and not working on 64bit app.
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Unable to detect resource leak in X64 VCL app

Post by madshi »

Hmmmm... I've just double checked. You're right! With the non-commercial edition, leak reporting currently doesn't seem to work with x64 projects. I'm not exactly sure why, will have to investigate why. It's supposed to work, so it must be a simple stupid bug somewhere. However, with the commercial edition it does work, I've double checked right now.
spanfkyous
Posts: 13
Joined: Fri Nov 10, 2017 1:29 am

Re: Unable to detect resource leak in X64 VCL app

Post by spanfkyous »

:D
Thank you, i will consider the subscribtion
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Unable to detect resource leak in X64 VCL app

Post by madshi »

Seems to be fixed in this build, can you confirm?

http://madshi.net/madCollectionBeta.exe (installer 2.8.8.1)
spanfkyous
Posts: 13
Joined: Fri Nov 10, 2017 1:29 am

Re: Unable to detect resource leak in X64 VCL app

Post by spanfkyous »

Sorry, I uninstalled 2.8.8.0 and reinstalled 2.8.8.1,
X64 si still not working,

I use this code:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  AllocMem(1000);
end;

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

Re: Unable to detect resource leak in X64 VCL app

Post by madshi »

I've tested again now. I've completely uninstalled 2.8.8.0, just to be safe. Then I've installed the non-commercial edition of 2.8.8.1, created a little test project. Added AllocMem(1000) in FormCreate, and an exception in Button1Click. If I click the button, the exception shows up with a hint "madExcept 5 non-commercial" in the exception box. If I don't click the button and just close the app, the leak report shows up, as expected. So everything's working fine here.

Tested with Rio. Tested both 64bit release and debug builds.

Can you please double check that you really got installer build 2.8.8.1? Maybe your browser cache gave you same old 2.8.8.0 instead of re-downloading? Also, please add a button and test an exception. Does that work in 64bit, and you get a proper exception box with a "non-commercial" label in it?
q675318
Posts: 16
Joined: Sun Dec 02, 2018 9:29 pm

Re: Unable to detect resource leak in X64 VCL app

Post by q675318 »

我知道原因

TRegistry.Create(KEY_WRITE or KEY_READ or KEY_WOW64_64KEY);

'SOFTWARE\Wow6432Node\madshi\madCollection'

'SOFTWARE\madshi\madCollection'

这样的提示,作者应该懂了吧!我已经改动了安装代码,现在可以很好的在x64 x32平台下运行
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Unable to detect resource leak in X64 VCL app

Post by madshi »

Can you explain what you mean? On my PC (win10 x64), it just works as it is, without me having to worry about Wow6432Node or not.
spanfkyous
Posts: 13
Joined: Fri Nov 10, 2017 1:29 am

Re: Unable to detect resource leak in X64 VCL app

Post by spanfkyous »

madExcept64.dll was signed in Dec.1.2018

Here is the install log:
need 'madBasic'
need 'madDisAsm'
'HKCU\Software\Embarcadero\BDS\20.0\Known Packages'\'D:\madCollection\madExcept\BDS20\win32\madExceptIde_.bpl' = -
'HKCU\Software\Embarcadero\BDS\20.0\Known Packages'\'D:\madCollection\madExcept\BDS20\win32\madExcept_.bpl' = -
'HKCU\Software\Embarcadero\BDS\20.0\Known Packages'\'D:\madCollection\madExcept\BDS20\win32\madExceptVcl_.bpl' = -
'HKCU\Software\Embarcadero\BDS\20.0\Known Packages'\'D:\madCollection\madExcept\BDS20\win32\madExceptWizard_.bpl' = -
'HKCU\Software\Embarcadero\BDS\20.0\Library\Win32'\'Search Path' -= 'D:\madCollection\madExcept\BDS20\win32;'
'HKCU\Software\Embarcadero\BDS\20.0\Library\Win64'\'Search Path' -= 'D:\madCollection\madExcept\BDS20\win64;'
'HKCU\Software\Embarcadero\BDS\20.0\C++\Paths\Win32'\'LibraryPath' -= 'D:\madCollection\madExcept\BDS20\win32;'
'HKCU\Software\Embarcadero\BDS\20.0\C++\Paths\Win64'\'LibraryPath' -= 'D:\madCollection\madExcept\BDS20\win64;'
'HKCU\Software\Embarcadero\BDS\20.0\C++\Paths\Win32'\'IncludePath' -= 'D:\madCollection\madExcept\BDS20\win32;'
'HKCU\Software\Embarcadero\BDS\20.0\C++\Paths\Win64'\'IncludePath' -= 'D:\madCollection\madExcept\BDS20\win64;'
'HKCU\Software\Embarcadero\BDS\20.0\Library\Win32'\'Search Path' -= 'D:\madCollection\madExcept\..\Plugins\win32;'
'HKCU\Software\Embarcadero\BDS\20.0\Library\Win64'\'Search Path' -= 'D:\madCollection\madExcept\..\Plugins\win64;'
'HKCU\Software\Embarcadero\BDS\20.0\C++\Paths\Win32'\'LibraryPath' -= 'D:\madCollection\madExcept\..\Plugins\win32;'
'HKCU\Software\Embarcadero\BDS\20.0\C++\Paths\Win64'\'LibraryPath' -= 'D:\madCollection\madExcept\..\Plugins\win64;'
'HKCU\Software\Embarcadero\BDS\20.0\C++\Paths\Win32'\'IncludePath' -= 'D:\madCollection\madExcept\..\Plugins\win32;'
'HKCU\Software\Embarcadero\BDS\20.0\C++\Paths\Win64'\'IncludePath' -= 'D:\madCollection\madExcept\..\Plugins\win64;'
'HKCU\Software\madshi\madExcept'\'plugin root' = -
'HKCR\.mep'\'' = -
'HKCR\madExceptPlugin\shell\open\command'\'' = -
'HKCR\madExceptPlugin\DefaultIcon'\'' = -
'HKCR\.mbr'\'' = -
'HKCR\madExceptBugReport\shell\open\command'\'' = -
'HKCR\madExceptBugReport\DefaultIcon'\'' = -
'HKCU\Software\Embarcadero\BDS\20.0\Globals'\'ForceEnvOptionsUpdate' = -
'BDS20\win32', FFFFFFFF, FFFFFFFFFFFFFFFF
'BDS20\win64', FFFFFFFF, FFFFFFFFFFFFFFFF
'BDS20', FFFFFFFF, FFFFFFFFFFFFFFFF
'Delphi 7', FFFFFFFF, FFFFFFFFFFFFFFFF
'Demos', FFFFFFFF, FFFFFFFFFFFFFFFF
'Dlls', FFFFFFFF, FFFFFFFFFFFFFFFF
'Help', FFFFFFFF, FFFFFFFFFFFFFFFF
'Tools', FFFFFFFF, FFFFFFFFFFFFFFFF
'BDS20\win32\madDumpObj.dcu', 19DE, 1D489792B1D8D41
'BDS20\win32\madDumpObj.h', 36, 1C5E7929D495F00
'BDS20\win32\madDumpObj.hpp', 4F5, 1D489792AEFF5EC
'BDS20\win32\madDumpObj.obj', 1A8E, 1D489792AF01CFA
'BDS20\win32\madExcept.dcu', 94793, 1D489792A7837E9
'BDS20\win32\madExcept.h', 34, 1C4B4EEF8A51100
'BDS20\win32\madExcept.hpp', 10E3C, 1D489792ABE89BB
'BDS20\win32\madExcept.obj', 6C022, 1D489792A4963A7
'BDS20\win32\madExceptIde_.bpl', 8600, 1D489792C07F280
'BDS20\win32\madExceptVcl.dcu', 1153, 1D489792B4E761A
'BDS20\win32\madExceptVcl.h', 3A, 1C4AED9F08B1700
'BDS20\win32\madExceptVcl.hpp', 831, 1D489792B38F413
'BDS20\win32\madExceptVcl.obj', 14E4, 1D489792B391B1D
'BDS20\win32\madExceptVcl_.bpi', 514, 1D489792B39B752
'BDS20\win32\madExceptVcl_.bpl', 5200, 1D489792BE5A072
'BDS20\win32\madExceptVcl_.dcp', 1EC9, 1D489792B537EB4
'BDS20\win32\madExceptVcl_.lib', 1800, 1D489792BB286A8
'BDS20\win32\madExceptWizard_.bpl', 8D800, 1D489792C342F0D
'BDS20\win32\madExcept_.bpi', 7914, 1D489792A4FF2BB
'BDS20\win32\madExcept_.bpl', 7A000, 1D489792AA9CB08
'BDS20\win32\madExcept_.dcp', 80D7A, 1D489792A899B98
'BDS20\win32\madExcept_.lib', 9C600, 1D489792BAEDD76
'BDS20\win32\madIWSupport.cpp', 165E, 1CA09F69FBC4100
'BDS20\win32\madIWSupport.dfm', 43E, 1D39054C162B300
'BDS20\win32\madIWSupport.h', 8F3, 1CA09F6B95D8880
'BDS20\win32\madIWSupport.pas', 1F61, 1D3F72BEEC366AC
'BDS20\win32\madLinkDisAsm.dcu', 1F5, 1D489792B18C9EF
'BDS20\win32\madLinkDisAsm.hpp', 49D, 1D489792AEA7830
'BDS20\win32\madLinkDisAsm.obj', 2D2, 1D489792AEA9F3E
'BDS20\win32\madListHardware.dcu', 226D, 1D489792B1992C4
'BDS20\win32\madListHardware.h', 40, 1C525A0FF691900
'BDS20\win32\madListHardware.hpp', 511, 1D489792AEBB096
'BDS20\win32\madListHardware.obj', 20DE, 1D489792AEBD7A0
'BDS20\win32\madListModules.dcu', FD7, 1D489792B18F5FB
'BDS20\win32\madListModules.h', 3E, 1C5E79265421C00
'BDS20\win32\madListModules.hpp', 507, 1D489792AEAED57
'BDS20\win32\madListModules.obj', FBC, 1D489792AEAED57
'BDS20\win32\madListProcesses.dcu', 236B, 1D489792B194476
'BDS20\win32\madListProcesses.h', 42, 1C5E7927E4ACD00
'BDS20\win32\madListProcesses.hpp', 518, 1D489792AEB3B6F
'BDS20\win32\madListProcesses.obj', 1D13, 1D489792AEB627D
'BDS20\win32\madMapFile.dcu', FE53, 1D489792AFF5DFE
'BDS20\win32\madMapFile.h', 36, 1C4AEDA131D3000
'BDS20\win32\madMapFile.hpp', 2340, 1D489792ACCB97C
'BDS20\win32\madMapFile.obj', C221, 1D489792ACD0794
'BDS20\win32\madNVAssistant.dcu', 11EF9, 1D489792B04B4B4
'BDS20\win32\madNVAssistant.h', 3E, 1C58956FAEDAC00
'BDS20\win32\madNVAssistant.hpp', 2F69, 1D489792C41E986
'BDS20\win32\madNVAssistant.obj', C9C0, 1D489792AD3E4C5
'BDS20\win32\madNVBitmap.dcu', 78AE, 1D489792B029209
'BDS20\win32\madNVBitmap.h', 38, 1C525A1042DCD00
'BDS20\win32\madNVBitmap.hpp', A12, 1D489792AD0FED6
'BDS20\win32\madNVBitmap.obj', 59E8, 1D489792AD14CEF
'BDS20\win32\madNVPrgrAlert.dcu', 4412, 1D489792AFFFA2F
'BDS20\win32\madNVPrgrAlert.h', 3E, 1C5E79294F12400
'BDS20\win32\madNVPrgrAlert.hpp', A6D, 1D489792ACDA3C9
'BDS20\win32\madNVPrgrAlert.obj', 3162, 1D489792ACDF1E2
'BDS20\win32\madStackTrace.dcu', A021, 1D489792B013291
'BDS20\win32\madStackTrace.h', 3C, 1C4AEDA26300000
'BDS20\win32\madStackTrace.hpp', 10E4, 1D489792C3E675F
'BDS20\win32\madStackTrace.obj', 843B, 1D489792ACF9F6E
'BDS20\win64\madDumpObj.dcu', 2623, 1D4897925C96A53
'BDS20\win64\madDumpObj.h', 36, 1C5E7929D495F00
'BDS20\win64\madDumpObj.hpp', 4F5, 1D4897924F92A8A
'BDS20\win64\madExcept.dcu', E39DE, 1D4897924137183
'BDS20\win64\madExcept.h', 34, 1C4B4EEF8A51100
'BDS20\win64\madExcept.hpp', 10D97, 1D4897924600489
'BDS20\win64\madExceptVcl.dcu', 1AD8, 1D48979260890D4
'BDS20\win64\madExceptVcl.h', 3A, 1C4AED9F08B1700
'BDS20\win64\madExceptVcl.hpp', 85D, 1D4897925ECA6BF
'BDS20\win64\madExceptVcl_.a', 6086, 1D4897925ED69FE
'BDS20\win64\madExceptVcl_.bpi', E28, 1D4897925EE544B
'BDS20\win64\madExceptVcl_.bpl', 7800, 1D489792651FFF4
'BDS20\win64\madExceptVcl_.dcp', 2A37, 1D48979260DE79A
'BDS20\win64\madExcept_.a', 3A9EF4, 1D489792527BAD5
'BDS20\win64\madExcept_.bpi', 1409A, 1D48979236F7724
'BDS20\win64\madExcept_.bpl', B2200, 1D48979244B1EAF
'BDS20\win64\madExcept_.dcp', B8C1C, 1D48979242C9CC0
'BDS20\win64\madIWSupport.dfm', 43E, 1D39054C162B300
'BDS20\win64\madIWSupport.h', 8F3, 1CA09F6B95D8880
'BDS20\win64\madIWSupport.pas', 1F61, 1D3F72BEEC366AC
'BDS20\win64\madLinkDisAsm.dcu', 389, 1D4897925BF8009
'BDS20\win64\madLinkDisAsm.hpp', 49D, 1D4897924F9037C
'BDS20\win64\madListHardware.dcu', 315B, 1D4897925C3293F
'BDS20\win64\madListHardware.h', 40, 1C525A0FF691900
'BDS20\win64\madListHardware.hpp', 515, 1D4897924F92A8A
'BDS20\win64\madListModules.dcu', 14C3, 1D4897925C04348
'BDS20\win64\madListModules.h', 3E, 1C5E79265421C00
'BDS20\win64\madListModules.hpp', 50B, 1D4897924F9037C
'BDS20\win64\madListProcesses.dcu', 2EA6, 1D4897925C1A2C5
'BDS20\win64\madListProcesses.h', 42, 1C5E7927E4ACD00
'BDS20\win64\madListProcesses.hpp', 51C, 1D4897924F92A8A
'BDS20\win64\madMapFile.dcu', 19B73, 1D48979254B4426
'BDS20\win64\madMapFile.h', 36, 1C4AEDA131D3000
'BDS20\win64\madMapFile.hpp', 2301, 1D4897924F72EE1
'BDS20\win64\madNVAssistant.dcu', 1E0BB, 1D4897925670735
'BDS20\win64\madNVAssistant.h', 3E, 1C58956FAEDAC00
'BDS20\win64\madNVAssistant.hpp', 2FA5, 1D489792661B627
'BDS20\win64\madNVBitmap.dcu', CA29, 1D48979255D440E
'BDS20\win64\madNVBitmap.h', 38, 1C525A1042DCD00
'BDS20\win64\madNVBitmap.hpp', A12, 1D4897924F77CED
'BDS20\win64\madNVPrgrAlert.dcu', 61E1, 1D48979254D66C9
'BDS20\win64\madNVPrgrAlert.h', 3E, 1C5E79294F12400
'BDS20\win64\madNVPrgrAlert.hpp', A6F, 1D4897924F72EE1
'BDS20\win64\madStackTrace.dcu', 1464F, 1D489792557C63D
'BDS20\win64\madStackTrace.h', 3C, 1C4AEDA26300000
'BDS20\win64\madStackTrace.hpp', F76, 1D48979265E8218
'Delphi 7\madDumpObj.dcu', 17C0, 1D489793E9C94F3
'Delphi 7\madExcept.dcu', 75174, 1D489793E51AF91
'Delphi 7\madExceptIde_.bpl', 7800, 1D489793F1EDF74
'Delphi 7\madExceptVcl.dcu', DA6, 1D489793EAC23FF
'Delphi 7\madExceptVcl_.bpl', 3C00, 1D489793F029F11
'Delphi 7\madExceptVcl_.dcp', 1849, 1D489793EAE6DCC
'Delphi 7\madExceptWizard_.bpl', 7AE00, 1D489793F3A5EB0
'Delphi 7\madExcept_.bpl', 63800, 1D489793E727B3E
'Delphi 7\madExcept_.dcp', 6F719, 1D489793E57A278
'Delphi 7\madIWSupport.dfm', 43E, 1D39054C162B300
'Delphi 7\madIWSupport.pas', 1F61, 1D3F72BEEC366AC
'Delphi 7\madLinkDisAsm.dcu', 1C7, 1D489793E9B0E70
'Delphi 7\madListHardware.dcu', 1E2A, 1D489793E9BD1AF
'Delphi 7\madListModules.dcu', E31, 1D489793E9B5C89
'Delphi 7\madListProcesses.dcu', 1C60, 1D489793E9B839B
'Delphi 7\madMapFile.dcu', D5DB, 1D489793E8F76A6
'Delphi 7\madNVAssistant.dcu', F409, 1D489793E925C9D
'Delphi 7\madNVBitmap.dcu', 6280, 1D489793E91724F
'Delphi 7\madNVPrgrAlert.dcu', 3727, 1D489793E8FEBCD
'Delphi 7\madStackTrace.dcu', 8698, 1D489793E908802
'Demos\ConfForm.dfm', 2E1, 1C28F2722321800
'Demos\ConfForm.pas', B6B, 1CE200404094F00
'Demos\EC.DPR', 1DC, 1CE2002B2AC9000
'Demos\EC.MES', 1A9B, 1C5ACF1A11C2800
'Demos\ecCrashParam.pas', 564, 1CD38F0C6AAC800
'Demos\ecDll.pas', 34A, 1CE2002AF190900
'Demos\ecMain.dfm', 1AB2, 1CD38D4F9DF5E00
'Demos\ecMain.pas', 2BEB, 1CD38D65F801A00
'Demos\ecMini.pas', 3D9, 1CE20028EE94A00
'Demos\ecStrings.pas', 550D, 1C9820143BFEF00
'Demos\ExcCatch.dpr', 373, 1CD38CD75D5A800
'Demos\ExcCatch.mes', 1A9A, 1C5ACF1BC873300
'Demos\LeakTest.dpr', 143, 1CD383E488DE900
'Demos\LeakTest.mes', 1CDE, 1CD383BCF8D9200
'Demos\LeakTestForm.dfm', 653, 1CD38EB52B9F100
'Demos\LeakTestForm.pas', 1162, 1CD38EB52B9F100
'Demos\madExcept.res', 4C4, 1C321F9176B7F00
'Demos\TestDbgMm.dpr', 152, 1CD3830E11D6C80
'Demos\TestDbgMm.mes', 1CDE, 1CD3830B6CBAF00
'Demos\TestDbgMmForm.dfm', 3C5, 1CD383078CE8B00
'Demos\TestDbgMmForm.pas', 558, 1CD3830694F4200
'Demos\TraceConf.dpr', 151, 1C5ACF1CF9A0300
'Demos\TraceConf.htm', 775, 1C28F27C6B45A00
'Demos\TraceConf.mes', 1A9B, 1C5ACF1F0FAEF00
'Dlls\madExcept32.dll', EB6B8, 1D489792EDFD940
'Dlls\madExcept64.dll', 15D0F8, 1D489792868E262
'Help\Content.htm', 6CF, 1C4C4E8DFD5BD00
'Help\madExcept.htm', 6D3, 1C4C4E91B708700
'order madExcept.url', A5, 1BFEA9B83B26400
'Tools\madCompileBugReport.exe', 86FA8, 1D48977EF4773BB
'Tools\madExceptPatch.exe', 9BE80, 1D48977ECF2EC92
'Tools\madExceptViewer.exe', 30E998, 1D489792DA82DED
'Tools\madPluginMan.exe', 811E8, 1D48977EFFD75AF
'Tools\madTestMailAPIs.exe', C9098, 1D48977EE7FFB2E
'Tools\madTraceProcess32.exe', EEF88, 1D48977EDC20853
'Tools\madTraceProcess64.exe', 2EC0F0, 1D4897840495A23
'Tools\README.TXT', A6F, 1C5C2F45263AD00
'www.madshi.net.url', 59, 1BFE9B9B71CC200
spanfkyous
Posts: 13
Joined: Fri Nov 10, 2017 1:29 am

Re: Unable to detect resource leak in X64 VCL app

Post by spanfkyous »

q675318 wrote:我知道原因

TRegistry.Create(KEY_WRITE or KEY_READ or KEY_WOW64_64KEY);

'SOFTWARE\Wow6432Node\madshi\madCollection'

'SOFTWARE\madshi\madCollection'

这样的提示,作者应该懂了吧!我已经改动了安装代码,现在可以很好的在x64 x32平台下运行

Maybe more clear?
q675318
Posts: 16
Joined: Sun Dec 02, 2018 9:29 pm

Re: Unable to detect resource leak in X64 VCL app

Post by q675318 »

Because the author's installer is 32-bit, it is automatically converted to the "SOFTWARE\madshi\madCollection" when writing the tools Association of the Registry "SOFTWARE\Wow6432Node\madshi\madCollection"Under this virtual node, so on a 64-bit system, we write a 32-bit program that recognizes this virtual registry that is specifically accessible to 32-bit programs and is associated with tools, but if the 64-bit program we write accesses the real registry location, And that real location setup didn't write the registry, so the 64-bit program couldn't get the real tools location!
Post Reply