Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

FNCSearchEdit and FastMM problem

 Post Reply Post Reply
Author
King Susan View Drop Down
Member
Member
Avatar

Joined: 23 Nov 2018
Posts: 52
Post Options Post Options   Quote King Susan Quote  Post ReplyReply Direct Link To This Post Topic: FNCSearchEdit and FastMM problem
    Posted: 20 May 2019 at 7:50am
Hello,

I use FastMM  4.991 downloaded from github.

I add a SearchEdit to a new form, and select an item from the default list and then close the program.

FastMM is reporting

<<
FastMM has detected an attempt to use an interface of a freed object. An access violation will now be raised in order to abort the current operation.

The current thread ID is 0x2288, and the stack trace (return addresses) leading to this error is:
40E93F [System.pas][System][@IntfCopy$qqrr44System.%DelphiInterface$17System.IInterface%x44System.%DelphiInterface$17System.IInterface%][38227]
A11EFB [FMX.TMSFNCStyles.pas][FMX.TMSFNCStyles][Tmsfncstyles.TTMSFNCStyles.SetActiveScene][1742]
A1A498 [FMX.TMSFNCCustomControl.pas][FMX.TMSFNCCustomControl][Tmsfnccustomcontrol.TTMSFNCCustomControlBase.Destroy][1210]
A1AEC1 [FMX.TMSFNCCustomControl.pas][FMX.TMSFNCCustomControl][Tmsfnccustomcontrol.TTMSFNCCustomControl.Destroy][2041]
BE4BAF [FMX.TMSFNCToolBar.pas][FMX.TMSFNCToolBar][Tmsfnctoolbar.TTMSFNCCustomToolBarElement.Destroy][6434]
BDF7B1 [FMX.TMSFNCToolBar.pas][FMX.TMSFNCToolBar][Tmsfnctoolbar.TTMSFNCDefaultToolBarButton.Destroy][4339]
4084C3 [System.pas][System][TObject.Free][17466]
BC205B [FMX.TMSFNCEdit.pas][FMX.TMSFNCEdit][Tmsfncedit.TTMSFNCEditButton.Destroy][2317]
C12CA9 [FMX.TMSFNCSearchEdit.pas][FMX.TMSFNCSearchEdit][Tmsfncsearchedit.TTMSFNCSearchDropDown.Destroy][770]
4084C3 [System.pas][System][TObject.Free][17466]
C11DED [FMX.TMSFNCSearchEdit.pas][FMX.TMSFNCSearchEdit][Tmsfncsearchedit.TTMSFNCSearchEdit.Destroy][403]
>>

Is this something that can be fixed ? It doesn't happen with the version of FastMM shipped with Delphi.

I do have $defineCatchUseOfFreedInterfaces.  With this turned off, there is an error : 'Project SearchEditTest.exe raised exception class $C0000005 with message 'access violation at 0x0040e758: read address of 0x80808080'.

Sue
Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3296
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 20 May 2019 at 11:49am
Hi,

I can only assume that this is a false positive marked by FastMM, we haven't received other reports. The SetActiveScene call is a class procedure that clears a global variable FScene: IScene in the destroy sequence of the component. This call is necessary to avoid invalid pointer issues. I suggest to raise this question with the developers of FastMM or use the default FastMM version in Delphi, where this issue does not occur.
Back to Top
King Susan View Drop Down
Member
Member
Avatar

Joined: 23 Nov 2018
Posts: 52
Post Options Post Options   Quote King Susan Quote  Post ReplyReply Direct Link To This Post Posted: 21 May 2019 at 3:07am
I have had a bit more of a look at this, and the problem that is showing appears to relate to destroying the popup after it has been displayed.  If the list of items is not displayed, the error does not occur.  SearchList is fine.

I have been using the fuller FastMM4 for many years now, and it is one of the first things I include in new projects.  It has saved me heaps of time in finding memory issues. They show up as soon as they are created.  The code is very stable and hasn't changed for a few years.  I need to continue to use it. 

Unfortunately this means it is impractical to use the component for now as it makes debugging difficult.

It may well be a false positive, but then again, maybe it isn't.

I will ask in forums about the false positive issue. The FastMM4 FAQ has an entry relating to the AV that is shown in my original post.
Q: My program used to work fine, but if I enable "FullDebugMode" and run it I get an access violation at address $8080xxxx. Why?
A: You are attempting to access properties of a freed object. When you free a block in "FullDebugMode", FastMM fills the freed memory area with a pattern of $80 bytes. If there were any pointers, long strings or object references inside the freed object they will now point to $80808080 which is in a reserved address space.



 
Back to Top
King Susan View Drop Down
Member
Member
Avatar

Joined: 23 Nov 2018
Posts: 52
Post Options Post Options   Quote King Susan Quote  Post ReplyReply Direct Link To This Post Posted: 21 May 2019 at 8:22am
I have posted a query on Delphi Praxis EN in the Delphi Questions and Answers, General Help, in case you are interested in the comments.
Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3296
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 21 May 2019 at 8:33am
Hi,

We'll follow up and see if we can improve the code to avoid this issue, yet it would be very helpful if we would have a sample that demonstrates this issue. Can you reproduce this with a TTMSFNCPopup on the form hooked up on a button.
Back to Top
King Susan View Drop Down
Member
Member
Avatar

Joined: 23 Nov 2018
Posts: 52
Post Options Post Options   Quote King Susan Quote  Post ReplyReply Direct Link To This Post Posted: 22 May 2019 at 1:02am
This error does not occur with TTMSFNCPopup linked to a button.  The comment about popups was related to memory leaks reported when the check to CatchUseOfFreedInterfaces is turned off.  It might be a side effect or a different problem.

A file with the project and FastMM4 files included is being emailed to support.

Thanks for having another look at this.

Sue
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down