ChrisL Posted April 30, 2014 Share Posted April 30, 2014 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? Thanks expandcollapse popup Opt("GuiOnEventMode",1) #include <GUIConstantsEx.au3> Global $hGui, $flashControl, $SWFObj _Gui() While 1 Sleep(250) WEnd Func _Gui() $hGui = GUICreate("ShockwaveFlash.ShockwaveFlash",280,280) GuiSetState() GUISetOnEvent($GUI_EVENT_CLOSE,"_Exit") $flashControl = _CreateSWF(@scriptDir & "\loading9.swf", 40,40, 200,200) Local $button = GUICtrlCreateButton("Delete and Renew",10,10) GUICtrlSetOnEvent($button,"_DeleteFlashControlAndCreateANewOne") EndFunc Func _DeleteFlashControlAndCreateANewOne() GUICtrlDelete($flashControl) 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) Sleep(250) $flashControl = _CreateSWF(@scriptDir & "\loading9.swf", 40,40, 200,200) EndFunc 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 EndWith Return $SWFActiveX EndFunc Func _Exit() Exit EndFunc loading9.zip [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
JohnOne Posted April 30, 2014 Share Posted April 30, 2014 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. Link to comment Share on other sites More sharing options...
ChrisL Posted April 30, 2014 Author Share Posted April 30, 2014 It's a real problem in a huge script, the one I posted above is a simplified script to show the problem [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
JohnOne Posted April 30, 2014 Share Posted April 30, 2014 Could you not solve the issue by not constantly deleting the object and making a new one? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Palestinian Posted April 30, 2014 Share Posted April 30, 2014 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. Link to comment Share on other sites More sharing options...
ChrisL Posted April 30, 2014 Author Share Posted April 30, 2014 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. [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
Bert Posted April 30, 2014 Share Posted April 30, 2014 could you simply use the adobe flash projector? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
JohnOne Posted April 30, 2014 Share Posted April 30, 2014 Could you not solve the issue by not constantly deleting the object and making a new one? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
ChrisL Posted May 1, 2014 Author Share Posted May 1, 2014 Ahh I miss-read that! I have now done this and it does solve the issue, I shouldn't really have to do this, I would expect the memory to be released. [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
JohnOne Posted May 1, 2014 Share Posted May 1, 2014 Agreed, but if I recall correctly it's not about to be fixed any time soon. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now