Delphi 64 Bit memory leaks not clearing?

delphi package - automated exception handling

Re: Delphi 64 Bit memory leaks not clearing?

Postby mattg » Sun Jul 05, 2020 8:50 pm

Stack Overflow error in madExcept64.dll

I start the app with leak checking off, then from main UI I do this:

MadExcept.SetChildLeakFiltering(False);
MadExcept.StopLeakChecking(False);
MadExcept.StartLeakChecking(False);

This gives a stack overflow in the madexcept64.dll.

If i turn leak checking on at startup then no stack overflow and the app looks ok.

Next turn on leak checking in the project options -> mad except
First line on the project i add:
MadExcept.StopLeakChecking(false);
MadExcept.SetChildLeakFiltering(False);

After startup i run:
MadExcept.ReportLeaksNow(False);
MadExcept.ClearLeaks(False,false);

The above should be near instant - yet i see the popup "Creating Leak Report" and nothing happens at all, but my app locks up, with no CPU usage, so something does not return.

Please can you test the above or advise the best method to do what we need to - capture running leaks.
mattg
 
Posts: 17
Joined: Thu Apr 27, 2017 11:25 pm

Re: Delphi 64 Bit memory leaks not clearing?

Postby madshi » Wed Jul 08, 2020 11:26 am

Generally, activating leak checking at runtime, while having leak checking disabled in the madExcept settings dialog is not a good idea because leak checking requires replacing the memory manager, and if you do that "late" that means you have allocations done by the old memory manager and allocations done by the new memory manager and then if the code tries to reallocate something, which memory manager is responsible then? If you ask the wrong memory manager to reallocate, it will create an exception because it doesn't know the allocation. And that is exactly what appears to be happening in this situation.

If you want to use leak checking, it's recommended (maybe even mandatory) to enable leak checking in the madExcept settings when you compile your EXE. You can then disable/reenable leak checking at will. But telling madExcept at first to not do leak checking and then trying to disable it at runtime later is problematic due to the memory manager issue described above.
madshi
Site Admin
 
Posts: 10274
Joined: Sun Mar 21, 2004 5:25 pm

Re: Delphi 64 Bit memory leaks not clearing?

Postby mattg » Wed Jul 15, 2020 3:55 am

[If you want to use leak checking, it's recommended (maybe even mandatory) to enable leak checking in the madExcept settings when you compile your EXE. You can then disable/reenable leak checking at will. But telling madExcept at first to not do leak checking and then trying to disable it at runtime later is problematic due to the memory manager issue described above.[/quote]

ok thats fine as I did that but never got a return, now have just re-tried this and it works as intended, so i missed something by the looks. I seem to be able to clear the leaks while running and it returns reasonably quickly now thankyou.
mattg
 
Posts: 17
Joined: Thu Apr 27, 2017 11:25 pm

Previous

Return to madExcept

Who is online

Users browsing this forum: No registered users and 19 guests

cron