Jump to content
Sign in to follow this  
myspacee

Free memory

Recommended Posts

myspacee

hello to all,

post my small script that use a lot of memory :

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)
global $click_X = 0, $click_Y = 0, $click_wait = 1000


Example()


; Simple example: Embedding an Internet Explorer Object inside an AutoIt GUI
; See also: http://msdn.microsoft.com/workshop/browser...netexplorer.asp
Func Example()
    Local $oIE, $GUIActiveX, $GUI_Button_Back, $GUI_Button_Forward
    Local $GUI_Button_Home, $GUI_Button_Stop, $msg
   
    $oIE = ObjCreate("Shell.Explorer.2")

  ; Create a simple GUI for our output
    GUICreate("Embedded Google StreetView", 640, 580, 0, 0, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN))
    $GUIActiveX = GUICtrlCreateObj ($oIE, 2, 2, 640, 500)
    $GUI_Button_Back = GUICtrlCreateButton("Back", 10, 550, 100, 30)
    $GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 550, 100, 30)
    $GUI_Button_Home = GUICtrlCreateButton("Home", 230, 550, 100, 30)
    $GUI_Button_Stop = GUICtrlCreateButton("Fullscreen", 330, 550, 100, 30)

    GUISetState()    ;Show GUI

    $oIE.navigate("http://maps.google.it/maps?f=q&source=s_q&hl=it&geocode=&q=duomo&sll=45.464134,9.189656&sspn=0.005042,0.009613&ie=UTF8&radius=0.23&rq=1&ll=45.463938,9.188583&spn=0,359.990387&z=17&layer=c&cbll=45.463767,9.188341&panoid=kSIfc4TPePi04oiU_jS6sg&cbp=12,67.43,,0,4.6")

    ToolTip("Please wait....",0,0)
    _click_here(380, 135, 6000)
    ToolTip("",0,0) 
    

  ; Waiting for user to close the window
    While 1
        $msg = GUIGetMsg()

        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $GUI_Button_Home
                $oIE.navigate("http://maps.google.it/maps?f=q&source=s_q&hl=it&geocode=&q=duomo&sll=45.464134,9.189656&sspn=0.005042,0.009613&ie=UTF8&radius=0.23&rq=1&ll=45.463938,9.188583&spn=0,359.990387&z=17&layer=c&cbll=45.463767,9.188341&panoid=kSIfc4TPePi04oiU_jS6sg&cbp=12,67.43,,0,4.6")
            Case $msg = $GUI_Button_Back
                $oIE.GoBack
            Case $msg = $GUI_Button_Forward
                $oIE.GoForward
            Case $msg = $GUI_Button_Stop
;~               $oIE.Stop
                _click_here(612, 158, 6000)
        EndSelect
       
    WEnd

    GUIDelete()
EndFunc ;==>Example


FUNC _click_here($click_X, $click_Y, $click_wait)
    MouseMove(0,0,0)
    MouseMove($click_X,$click_Y,$click_wait)
    sleep(6000)
    MouseClick("left")
    MouseMove(0,0,0)
    $click_X = 0
    $click_Y = 0
    $click_wait = 1000
EndFunc

thi is a part of bigger script. So how I can free some memory when close it ?

m.

Edited by myspacee

Share this post


Link to post
Share on other sites
myspacee

Thank you both for reply.

I post my script. This was taken from forum. And everyone can test its memory needs.

My bigger script need a lot of works before post, so i isolated this portion of code, that needs more optimization.

I use always search function and post only if i can't find anything.

Sorry for bad english i'm working to improve it.

But i'm here to thank you all for help.

m.

Edited by myspacee

Share this post


Link to post
Share on other sites
myspacee

Hello again,

i finish to try all IE web browser example find on forum. All consume a lot of ram when surfing. (expecially in google street view)

Not found any working Web Broswer script that use firefox, is possible to embed firefox in Autoit GUI ?

thank you for any info.

m.

____ Edit

all scripts found on this subjet are related to Mozilla browser ActiveX.

download, install and register return an error :

DllRegisterServer in mozctlx.dll non riuscito.
Codice restituito: 0x8002801c

Find also JamesBrooks attempts,

but can't figure how getting this work. Anyone can help to do small step forward ?

Thank you.

Edited by myspacee

Share this post


Link to post
Share on other sites
neilontherock

why does my script never seem to reduce memory?

Share this post


Link to post
Share on other sites
Tvern

I can't say I see excessive memory usage during, or after the script has ran (things like google maps, will need some memory, but that's expected). I do know that $oIE.navigate likes to eat a little memory every time it's called, but this only shows when calling it very often.

What you could try is calling $oIE.quit() to explicitly close the IE object, or try to release some of the memory while it runs and/or on exit with this.

Share this post


Link to post
Share on other sites
wakillon

Try to put a sleep ( 30 ) in your while Loop for reduce memory usage

and give your feedback Posted Image


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites
Tvern

That's cpu usage and it shouldn't be used in combination with GUIGetMsg() as far as I know.

Share this post


Link to post
Share on other sites
wakillon

That's cpu usage and it shouldn't be used in combination with GUIGetMsg() as far as I know.

A big value shouldn't be used in combination with GUIGetMsg() but a little, yes !

and it reduce memory usage.


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

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  

×