How do I suppress TFixedStreamAdapter leak error?

delphi package - automated exception handling
Post Reply
standay
Posts: 5
Joined: Mon Nov 02, 2020 12:15 pm

How do I suppress TFixedStreamAdapter leak error?

Post by standay »

Hi, I'm using the Drag and Drop Component Suite 5.81 for Delphi (from github) and I keep getting a TFixedStreamAdapter/GetMemCallback error on line 1296. I'll put some text from one of the reports I keep getting below.

Using Madexcept 5.0.0, drag and drop stuff is version 5.81. The drag and drop guy has been trying to fix but says if he gets rid of the madexcept error it causes a lot of other problems. The drag/drop code is very complex and my guess is it's a "false positive" from madexcept. There is NO error from Delphi (10.3 Version 26.0.33219.4899), just this resource leak error from madexcept.

Since there's no error from Delphi, I'd be happy if I could just suppress this madexcept error. Can anyone tell me how I might do that?

allocation number: 2540
program up time: 14.97 s
type: TFixedStreamAdapter
address: $59c6fd8
size: 36
access rights: read/write
reference counter: 3

main thread ($5c60):
671a52b3 madExcept32.dll madExceptDbg 1736 GetMemCallback
0040c948 Project1.exe System 34385 InvokeRecordConstructor
00406ec8 Project1.exe System 4799 @getmem
00408712 Project1.exe System 17394 TObject.NewInstance
00410020 Project1.exe System 39278 TInterfacedObject.NewInstance
00408ed7 Project1.exe System 18773 @ClassCreate
004eab79 Project1.exe System.Classes 17102 TStreamAdapter.Create
00663091 Project1.exe Vcl.AxCtrls 1003 TOleStream.Create
00667080 Project1.exe DragDropFormats 1296 TCustomSimpleClipboardFormat.DoSetData
0066e669 Project1.exe DragDrop 1129 TClipboardFormat.SetDataToMedium
0066e690 Project1.exe DragDrop 1136 TClipboardFormat.SetData
006669d8 Project1.exe DragDropFormats 1012 TCustomSimpleClipboardFormat.Create
0066b7b6 Project1.exe DropTarget 1515 TCustomDropTarget.SetPerformedDropEffect
0066a30a Project1.exe DropTarget 880 TCustomDropTarget.DoDrop
0066a1b8 Project1.exe DropTarget 766 TCustomDropTarget.Drop
75d54c7b RPCRT4.dll NdrStubCall2
76c4b3cc combase.dll CStdStubBuffer_Invoke
761d37cb USER32.dll DispatchMessageW
006565c7 Project1.exe Vcl.Forms 10724 TApplication.ProcessMessage
madshi
Site Admin
Posts: 10338
Joined: Sun Mar 21, 2004 5:25 pm

Re: How do I suppress TFixedStreamAdapter leak error?

Post by madshi »

You should be able to use the callstack based "HideLeak()" API:

http://help.madshi.net/madExceptUnit.htm#HideLeak
standay
Posts: 5
Joined: Mon Nov 02, 2020 12:15 pm

Re: How do I suppress TFixedStreamAdapter leak error?

Post by standay »

madshi wrote:You should be able to use the callstack based "HideLeak()" API:

http://help.madshi.net/madExceptUnit.htm#HideLeak
Thanks! I was able to get the errors suppressed by doing the following:

Add madexcept, DragDropFormats to Uses

Then in the TForm1.DropComboTarget1Drop procedure, add these lines:

Code: Select all

  HideLeak(TFixedStreamAdapter,1);
  HideLeak('GlobalAlloc');
I only needed to add the HideLeak in the Drop procedure as the errors only seem to crop up when I drop a file.

Hopefully this will help anyone else having this problem.
madshi
Site Admin
Posts: 10338
Joined: Sun Mar 21, 2004 5:25 pm

Re: How do I suppress TFixedStreamAdapter leak error?

Post by madshi »

FWIW, I would recommend adding a few lines to the callstack, otherwise you're basically telling madExcept to ignore any and all GlobalAlloc leaks. I mean it's fine if you want to do that, but it might not be your intention.
standay
Posts: 5
Joined: Mon Nov 02, 2020 12:15 pm

Re: How do I suppress TFixedStreamAdapter leak error?

Post by standay »

madshi wrote:FWIW, I would recommend adding a few lines to the callstack, otherwise you're basically telling madExcept to ignore any and all GlobalAlloc leaks. I mean it's fine if you want to do that, but it might not be your intention.
OK, how do I do that?
standay
Posts: 5
Joined: Mon Nov 02, 2020 12:15 pm

Re: How do I suppress TFixedStreamAdapter leak error?

Post by standay »

OK, maybe this is what you are suggesting by "adding a few lines to the callstack":

Code: Select all

main thread ($29d8):
671a69f6 madExcept32.dll madExceptDbg     2781 GlobalAllocCallback
0081a249 SRDJournal.exe  DragDropFormats  1258 TCustomSimpleClipboardFormat.DoSetData
00821931 SRDJournal.exe  DragDrop         1129 TClipboardFormat.SetDataToMedium
HideLeak(TFixedStreamAdapter,2);
HideLeak('GlobalAlloc|GlobalAllocCallback|TCustomSimpleClipboardFormat.DoSetData|TClipboardFormat.SetDataToMedium');

That still works to suppress the error and I'm assuming it will only be suppressed when it has that combination of lines in the callstack and not suppress other GlobalAlloc errors?

Also, with this: HideLeak(TFixedStreamAdapter,2); does the "2" mean that kind of error will be reported if I have 2 or more occurances?

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

Re: How do I suppress TFixedStreamAdapter leak error?

Post by madshi »

Yep, that looks like a good callstack to use.

And yes, if there are more than 2 TFixedStreamAdapter leaks when your process shuts down, all of them will be reported. If 2 or less are found, none of them will be reported.
standay
Posts: 5
Joined: Mon Nov 02, 2020 12:15 pm

Re: How do I suppress TFixedStreamAdapter leak error?

Post by standay »

madshi wrote:Yep, that looks like a good callstack to use.

And yes, if there are more than 2 TFixedStreamAdapter leaks when your process shuts down, all of them will be reported. If 2 or less are found, none of them will be reported.
Got it, thanks for the help.
Post Reply