Detected resource leak to early

delphi package - automated exception handling

Detected resource leak to early

Postby MFr » Fri Jun 22, 2018 12:02 pm

Hello,
i try using madexcept to detect memory leaks. (Tokio)
While debuging i came throu "class function TEncoding.GetUnicode: TEncoding;" in unit unit System.SysUtils where a TUnicodeEncoding is created.
It is freed in class destructor TEncoding.Destroy; but after madexcept reports leaks.
What can i do?
MFr
 
Posts: 4
Joined: Fri Jun 22, 2018 11:22 am

Re: Detected resource leak to early

Postby madshi » Tue Jun 26, 2018 9:48 am

madExcept's leak reporting is done in madExcept32.dll, and it should be done after your EXE has already fully finalized (after all the "finalization" sections have run through). So how can that be too early?
madshi
Site Admin
 
Posts: 9719
Joined: Sun Mar 21, 2004 5:25 pm

Re: Detected resource leak to early

Postby MFr » Mon Jul 02, 2018 1:49 pm

Hello,
i don't know how and why. Lets explain.

I have a project named "TestQrtInfrastructure". It requires some packages. In the file "TestQrtInfrastructure.dpr" the uses starts with "madExcept".

When i start the project, the ui appears (DUnit). Then i close the app. Then in this order
- the form disapers
- a small window from madexcept apers to collect leaks
- a windows named madexcept view apears showing leaks
- delphi stoppes at a breakpoint in unit System.SysUtils in class destructor TEncoding.Destroy;

I would expect this order:
- the form disapers
- delphi stoppes at a breakpoint in unit System.SysUtils in class destructor TEncoding.Destroy;
- a small window from madexcept apers to collect leaks
- a windows named madexcept view apears showing leaks
MFr
 
Posts: 4
Joined: Fri Jun 22, 2018 11:22 am

Re: Detected resource leak to early

Postby madshi » Mon Jul 09, 2018 9:08 am

Hmmmm... That seems somewhat weird. Two questions:

1) I suppose that breakpoint in System.SysUtils is inside of RTL.bpl?
2) I suppose madExcept is linked into your EXE file? Or are you using madExcept_.bpl as a runtime package?
madshi
Site Admin
 
Posts: 9719
Joined: Sun Mar 21, 2004 5:25 pm

Re: Detected resource leak to early

Postby MFr » Wed Jul 11, 2018 6:22 am

Hm, how do i know?

In "the Event Log" there is a "Module Load: rtl250.bpl. Has Debug Info. ...", therefore i assume yes to 1.

There is a "Module Load: madExcept32.dll ..." too. Can i assume no for 2.?

Now i add "madBasic_;madDisAsm_;madExcept_" to "Runtime Packackes" in the project options, but the problem still occurs.
MFr
 
Posts: 4
Joined: Fri Jun 22, 2018 11:22 am

Re: Detected resource leak to early

Postby madshi » Wed Jul 11, 2018 7:36 am

Hmmmm... Can you reproduce this problem in a brand new almost empty test project? That would allow me to reproduce the problem on my PC, which would make it much easier for me to analyze the situation in detail.
madshi
Site Admin
 
Posts: 9719
Joined: Sun Mar 21, 2004 5:25 pm


Return to madExcept

Who is online

Users browsing this forum: Majestic-12 [Bot] and 1 guest

cron