"Filtering child leaks" runs slow, finally crashes

contains all delphi packages mentioned below
Post Reply
aehimself
Posts: 16
Joined: Thu Apr 16, 2020 6:52 am

"Filtering child leaks" runs slow, finally crashes

Post by aehimself »

Hello,

We have a large legacy application written in Delphi where we were battling with resource leaks for ages. I have experimented with different products without much success when I realized if we already bought and using MadCollection; why not to try that one. Currently we have MadCollection 2.8.8 running on Delphi 10.3.3.
The first strange thing was that in the Tools -> MadExcept -> Configuration only shows 5 checkboxes (IDE exception catching, unicode hack and 3 project adjustment options) and does not allow me to turn resource monitoring on. After a bit of Googling I just added StartLeakChecking(False); before Application.Initialize in the .dpr file and it seemed to be working.

After getting rid of leaks in the logon screen and the framework (I know, I know...) I went ahead to actually do real testing; and I hit a brick wall. Just by logging on and then closing the application the "Filtering child leaks" window shows up (started from IDE: ~15-20 minutes; by launching .EXE ~5 minutes) and then disappears. The IDE actually tells me that it crashes because of an access violation. Stack trace is the following:
StackTrace.png
StackTrace.png (18.36 KiB) Viewed 4117 times
I really would like to check in the leak detection change so all developer colleagues will get notified and can hunt for those leaks, but it is not really an option if they have to wait 25 minutes after shutting down the application each time. So my questions are... how to get rid of this AV and make the leak collection finish; and how to disable / fasten up child leak detection?

Thanks! :)
aehimself
Posts: 16
Joined: Thu Apr 16, 2020 6:52 am

Re: "Filtering child leaks" runs slow, finally crashes

Post by aehimself »

Please disregard the Access Violation. Someone thought it's a good idea to put an Application.ProcessMessages after form closure so a it attempted to process a timer message of a non-existing component.
After fixing it the "Filtering child windows" now runs for 40 minutes and counting.

Is there a way to turn this feature off to speed up the leak report?
madshi
Site Admin
Posts: 10528
Joined: Sun Mar 21, 2004 5:25 pm

Re: "Filtering child leaks" runs slow, finally crashes

Post by madshi »

You could call this function during your project's finalization:

Code: Select all

function GetLeakReport (limitedToCurrentThread: boolean = true; includeCallstacks: boolean = true; hideChildLeaks: boolean = true) : UnicodeString;
This allows you to specifically define "hideChildLeaks". However, the one disadvantage of using this approach is that the leak reporting will be done before all the unit finalizations are run through, so you will get some false positive leaks, which would be cleared up otherwise.

Hope that helps?
aehimself
Posts: 16
Joined: Thu Apr 16, 2020 6:52 am

Re: "Filtering child leaks" runs slow, finally crashes

Post by aehimself »

I'd have been happier if there would be an option to enable / disable this globally.
Well, if it's not supported it's not supported; I'll give the manual leak report a try.
madshi
Site Admin
Posts: 10528
Joined: Sun Mar 21, 2004 5:25 pm

Re: "Filtering child leaks" runs slow, finally crashes

Post by madshi »

Well, it would be possible to add it, of course. Busy with another project atm, though...
Post Reply