Possible memory leak on drag

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
neville
Posts: 49
Joined: Tue Apr 15, 2008 8:37 am

Possible memory leak on drag

Post by neville » Tue Feb 09, 2016 1:24 pm

I seem to be getting a memory leak (about 1 MB) when dragging an image (LiveCode 7.1.1) using code

on dragStart
....
put the long ID of the target into tObj
export snapshot from tObj to tVar as PNG

set the width of img "DragImage" to the width of tObj
set the height of img "DragImage" to the height of tObj
set the visible of image "DragImage" to false
put tVar into img "DragImage"

put the clickH - the left of the target into xOffset
put the clickV - the top of the target into yOffset
set the dragImageOffset to xOffset,yOffset
set the dragImage to the short id of img "DragImage"
set the dragData["private"] to gridCoords(item 1 of the loc of the target,item 2 of the loc of the target)
---

dragMove does nothing unusual, just sets the dragAction to either "none" or "move"

There is also an Xcode console message

LiveCode-Community[13158:1963210] _DPSDiscardEvents: FlushEventsMatchingListFromQueue returned error (-50)

which appears at the start of the drag (possibly indicating an event reference being lost?) I was debugging an external when I found this - the external is not being called when the leak and console message occur however.

Any ideas?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10057
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Possible memory leak on drag

Post by FourthWorld » Tue Feb 09, 2016 5:46 pm

You may want to test that script in the latest development version, 8.0 DP14. It may have already been fixed (some work was done with drag-and-drop recently), but if not they'll want to see a bug report on that so they can take care of it right away.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

neville
Posts: 49
Joined: Tue Apr 15, 2008 8:37 am

Re: Possible memory leak on drag

Post by neville » Wed Feb 10, 2016 1:45 am

It does appear to happen in LC 8 p14 --- Leaks instrument is slightly confusing because there seems to be a memory leak in dp14 which occurs even before my stack opens. The Console definitely still reports the FlushEvents error on each dragStart. I have constructed a test stack with just a draggable object to isolate from my external code as a bug report; it does seem to be an LC library memory leak in drag, or possibly the pasteboard operation when creating the dragImage.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10057
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Possible memory leak on drag

Post by FourthWorld » Wed Feb 10, 2016 2:08 am

Thanks for testing that. You can file a report with your details and a recipe here:
http://quality.livecode.com/
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

neville
Posts: 49
Joined: Tue Apr 15, 2008 8:37 am

Re: Possible memory leak on drag

Post by neville » Sat Feb 13, 2016 3:04 am

Confirmed [Bug 16893] present since LC6.7.x

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Possible memory leak on drag

Post by jacque » Sat Feb 13, 2016 6:21 pm

Nice work Neville. I think this will fix a lot of issues. Thanks for reporting it.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply