Sign in to follow this  
Followers 0

Memory Leak with Flash

10 posts in this topic

I have a memory leak caused by an object ShockwaveFlash.

The below script will delete the the control and the object and recreate it, if you watch the memory in Task Manager it keeps going up every time you delete and recreate the control.

Any ideas?




#include <GUIConstantsEx.au3>
Global $hGui, $flashControl, $SWFObj


While 1

Func _Gui()

$hGui = GUICreate("ShockwaveFlash.ShockwaveFlash",280,280)

$flashControl = _CreateSWF(@scriptDir & "\loading9.swf", 40,40, 200,200)

Local $button = GUICtrlCreateButton("Delete and Renew",10,10)


Func _DeleteFlashControlAndCreateANewOne()

ConsoleWrite("$SWFObj is object = " & IsObj($SWFObj) & @CRLF)
$SWFObj = 0
ConsoleWrite("$SWFObj is object = " & IsObj($SWFObj) & " so why don't I get my memory back?" & @CRLF)
$flashControl = _CreateSWF(@scriptDir & "\loading9.swf", 40,40, 200,200)


Func _CreateSWF($SWFPath, $SWFL, $SWFT, $SWFW, $SWFH, $SWFBGColor = "#000000")

If NOT FileExists($SWFPath) then Return

$SWFObj = ObjCreate("ShockwaveFlash.ShockwaveFlash")
Local $SWFActiveX = GUICtrlCreateObj($SWFObj, $SWFL, $SWFT, $SWFW, $SWFH)

With $SWFObj
.Movie = $SWFPath
.ScaleMode = 1
.bgcolor = $SWFBGColor
.Loop = True
.allowScriptAccess = "Always"
.Quality = 1
.Playing = 1
.Menu = 1

Return $SWFActiveX


Func _Exit()

Share this post

Link to post
Share on other sites

I've seen this issue raised before, I don't think there was a solution if I recall.

Let me ask, id this a real world problem for you or are you just showcasing that you think you found a bug?

Can you demonstrate the real world issue if it is that?

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post

Link to post
Share on other sites

Or perhaps add a long sleep duration between deleting and creating the object, I had the same issue with _IENavigate (irrelevant I know) where _IEQuit didn't work everytime and the process would start hugging the memory and causing a leak.

Share this post

Link to post
Share on other sites

I do delete the object and recreate and that is where the memory leak happens, even if there is a long delay there is always memory taken up when you create a flash object delete it and create another several times.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0