Not reporting leaks

delphi package - automated exception handling

Not reporting leaks

Postby rsassen » Tue Nov 10, 2020 9:59 am

Hi,

I'm trying to figure out why my large project does not report memory leaks (C++ Builder Sydney R1; madCollection 2.8.9.1; VCL application (converted from earlier C++ Builder version); legacy compiler; mostly statically linked; dynamic RTL; > 800 units, the resulting exe is 42 Mb, the tds file is 213 Mb). Things I have checked:

  • In the madExcept settings leak reporting is on.
  • madExcept is linked into the application (madBasic_.lib, madDisAsm_.lib, madExcept_.lib).
  • madExcept32.dll is present in the folder where the exe is. (note: DLL file properties report version 4.0.6.0, which is the same as my earlier version of madExcept. But the file size is 970.560 bytes, which differs from my earlier version of madExcept)
  • No message "Well done = No leaks found" either.
  • When I manually call Madexcept::StartLeakChecking soon after the start of the application, it does report leaks when the application exits. But I'd rather have leak checking started immediately when starting the application.
  • A small sample application compiled in the same IDE *does* report leaks.

Do you have any suggestion as where to look for the reason no leaks are reported? E.g. includes/links to check, any (debug) output/logging created during compile I could check? I've had a look at the contents of madExceptWizard.txt, but I'm not sure what to look for.

Hope you can help!
rsassen
 
Posts: 15
Joined: Fri Jun 20, 2014 2:41 pm

Re: Not reporting leaks

Postby madshi » Wed Nov 11, 2020 8:01 pm

You can check out the RCDATA\MADEXCEPT resource in your compiled EXE file, using the freeware "Resource Hacker". Does it say "ReportLeaks = False" or "ReportLeaks = True"?
madshi
Site Admin
 
Posts: 10303
Joined: Sun Mar 21, 2004 5:25 pm

Re: Not reporting leaks

Postby rsassen » Thu Nov 12, 2020 8:56 am

I cannot find RCDATA\MADEXCEPT , I think you mean RCDATA\TMADEXCEPT (starting with a "T")?

That one says Enabled = True, ReportLeaks = True.
rsassen
 
Posts: 15
Joined: Fri Jun 20, 2014 2:41 pm

Re: Not reporting leaks

Postby madshi » Thu Nov 12, 2020 11:50 am

Oops yes, that's the one I meant.

Hmmmmm... Does leak reporting fail both when running from inside and outside the IDE?
madshi
Site Admin
 
Posts: 10303
Joined: Sun Mar 21, 2004 5:25 pm

Re: Not reporting leaks

Postby rsassen » Thu Nov 12, 2020 12:57 pm

Yes, also when running outside the IDE, leaks are not reported unless I call Madexcept::StartLeakChecking myself after starting the application.
rsassen
 
Posts: 15
Joined: Fri Jun 20, 2014 2:41 pm

Re: Not reporting leaks

Postby madshi » Thu Nov 12, 2020 1:16 pm

That's really weird. The only thing coming to my mind would be for you to add madExcept.pas and mad.inc into your project, so they're actually compiled into your EXE file, instead of using the precompiled DCU/OBJ files that shipping with madExcept. This way you can actually set breakpoints in madExcept.pas to check what's going on.
madshi
Site Admin
 
Posts: 10303
Joined: Sun Mar 21, 2004 5:25 pm

Re: Not reporting leaks

Postby rsassen » Thu Nov 12, 2020 3:27 pm

Thanks, I'll give it a try compiling madExcept.pas into my project.
I'll let you know tomorrow.
rsassen
 
Posts: 15
Joined: Fri Jun 20, 2014 2:41 pm

Re: Not reporting leaks

Postby rsassen » Fri Nov 13, 2020 10:29 am

Thanks to your suggestions I've found the issue in my code. After compiling madExcept.pas into my application, I now got an access violation at the startup of my application, which pointed me to a problem in my code. By some coincidence this issue manifested itself before not with an access violation, but by interfering with the proper working of leak checking in madExcept. After fixing this problem and removing madExcept.pas from my project again, madExcept reports leaks as expected.

Thanks for the support, it is much appreciated!
rsassen
 
Posts: 15
Joined: Fri Jun 20, 2014 2:41 pm

Re: Not reporting leaks

Postby madshi » Fri Nov 13, 2020 10:36 am

Sounds like a very weird problem, to stop leak reporting from working. Glad you found it! :D
madshi
Site Admin
 
Posts: 10303
Joined: Sun Mar 21, 2004 5:25 pm


Return to madExcept

Who is online

Users browsing this forum: hyoung3 and 18 guests