Jump to content

Memory Leak with PixelCheckSum()


sam007
 Share

Recommended Posts

Hi guys,

so first of all sorry for my bad english.

Ok, let's head to the topic:

Im playing around at the moment with a script for a little flash game - since games give theier information to the user via visualisations, i need to respons to actions via checking if a pixelregion has changed or is still the same...

so the point is: i use the PixelChekSum function call very frequently - though i tried to enchance the performance by minimizing the checked areas, it seems like my frequent use of this function causes the FlashPlugin to crash in the IE 7.0 - ok i captured this malefunction and my script restarts it self - nut it takes about 5 minutes and it will allwasy crash after about 10 mins of running.

So as a ration of 5/10 mins is not quiet good, i was asking me, if there is a possibility to free the memory, which is allocated by every PixelCheckSum().

To give you an example:

When the script starts, the size of memory IE 7.0 allocates is about ~480MB in the taskmgr

After 10 minutes its about 1.200 MB .... and then i think the memory of the FlashPlugin is full an it crashes, what causes IE 7.0 to crash, which needs about 3 mins to "repair" and makes my hole system unstabel so that i need to constantly wait 5 mins after each crash

(my friend is playing the game as it was imagined to be played, and he does this about 8h without any crash)

actually i dont understand, why the memory of an autoit scritp should be allocated in the IE 7.0 its working with - but on the other side i dont really know anything about the way this is handled by autoit :lmao:

So i thank you very much for each usefull suggestion you could give me on this problem :)

by the way, here is my system:

Betriebssystemname Microsoft® Windows Vista Ultimate

Version 6.0.6001 Service Pack 1 Build 6001

Systemhersteller MICRO-STAR INTERNATIONAL CO.,LTD

Systemmodell MS-7345

Systemtyp x64-basierter PC

Prozessor Intel® Core2 Quad CPU Q6600 @ 2.40GHz, 2403 MHz, 4 Kern(e), 4 logische® Prozessor(en)

BIOS-Version/-Datum American Megatrends Inc. V1.8, 24.01.2008

SMBIOS-Version 2.5

Windows-Verzeichnis C:\Windows

Systemverzeichnis C:\Windows\system32

Startgerät \Device\HarddiskVolume1

Gebietsschema Deutschland

Hardwareabstraktionsebene Version = "6.0.6001.18000"

Installierter physikalischer Speicher (RAM) 2,00 GB

Gesamter realer Speicher 2,00 GB

Verfügbarer realer Speicher 1,06 GB

Gesamter virtueller Speicher 4,23 GB

Verfügbarer virtueller Speicher 2,72 GB

Größe der Auslagerungsdatei 2,29 GB

Auslagerungsdatei C:\pagefile.sys

Link to comment
Share on other sites

ok here you go - i'm sorry, but this phpCodebox just kills the formatation....

CODE
Global $Paused

HotKeySet("^x", "ExitS")

HotKeySet("{PAUSE}", "TogglePause")

Start()

Func Start()

;Alle Fenster schließen

While (WinExists("http://www.xyz.org/index.php?action=Client&Client=0""))

WinKill("http://www.xyz.org/index.php?action=Client&Client=0", "")

Sleep(2000)

WEnd

While (WinExists("XYZ"))

WinKill("XYZ", "")

Sleep(2000)

WEnd

While (WinExists("Leere Seite"))

WinKill("Leere Seite", "")

Sleep(2000)

WEnd

$Username = "xyz"

$PW = "xyz"

Run("C:\Program Files (x86)\Internet Explorer\iexplore.exe", "", @SW_MAXIMIZE)

Sleep(5000)

If Not(WinExists("Leere Seite"))Then

ToolTip("Timeout zum Login...Restart", 0, 0)

While(WinExists("Internet Explorer") Or WinExists("Leere Seite")Or WinExists("Microsoft Visual"))

WinKill("Internet Explorer")

WinKill("Leere Seite")

WinKill("Microsoft Visual")

Sleep(20000)

WEnd

Start()

EndIf

Sleep(200)

WinSetState("Leere Seite", "", @SW_MAXIMIZE)

Sleep(200)

Send("http://www.xyz.org/")

Send("{ENTER}")

ToolTip("Warte auf xyz...", 0, 0)

Sleep(5000)

MouseClick("left",935,248,2,0)

If Not(WinActive("XYZ"))Then

ToolTip("Timeout zum Login...Restart", 0, 0)

While(WinExists("Internet Explorer") Or WinExists("Leere Seite")Or WinExists("Microsoft Visual"))

WinKill("Internet Explorer")

WinKill("Leere Seite")

WinKill("Microsoft Visual")

Sleep(20000)

WEnd

Start()

EndIf

;benutzerdaten eingeben

MouseClick("left",935,248,2,0)

Send(String($Username))

Send("{TAB}")

Send(String($PW))

Sleep(500)

Send("{ENTER}")

Sleep(5000)

;erfolgreich eingelogt?

$StartCheckBox = 722144595

If Not($StartCheckBox = PixelChecksum(509,670, 605, 690)) Then

ToolTip("Timeout beim Login...Restart", 0, 0)

While(WinExists("Internet Explorer") Or WinExists("Leere Seite")Or WinExists("Microsoft Visual"))

WinKill("Internet Explorer")

WinKill("Leere Seite")

WinKill("Microsoft Visual")

Sleep(1500)

WEnd

Start()

EndIf

;Reparieren

;$Reparieren_out = PixelChecksum(185,612,208,638)

MouseMove(273,630)

Sleep(5000)

MouseClick("left",273,630,2)

ToolTip("Es wurde repariert!", 0, 0)

;START Klicken

Sleep(5000)

MouseClick("left",554,676,1,0)

While Not(WinActive("http://www.xyz.org/index.php?action=Client&Client=0"))

ToolTip("Warte auf XYZ Client", 0, 0)

Sleep(5000)

WEnd

WinSetState("http://www.xyz.org/index.php?action=Client&Client=0", "", @SW_MAXIMIZE)

ToolTip("Initialisiere....5sekunden", 0, 0)

Sleep(5000)

;setze DISTANZ als Listenordnung

MouseMove(997,128, 0)

MouseClick("left",997,128,1,0)

Sleep(2000)

MouseMove(932,145)

Sleep(1000)

MouseClick("left",932,145,1,0)

$ScreenCenterX = 512

$ScreenCenterY = 391

$Boxnumber =1

$MonIconSaveX = 927

$MonIconSaveY = 148

$MonIconX = 831

$MonIconY = 181

$MonclickX = 900

$MonclickY = 185

$MenuMoveCheckBox = PixelChecksum(840,126, 845, 131)

$MonsterKillCheckBox = PixelChecksum(950,662, 973, 668)

$MonsterIcon_out = 3163828594

$MonsterIcon_over = 2901150691

$SpielerIcon_out = 3971694605

$SchiffTot = 1694889563

$HoheCheckBox = 539634895

$Kills = 0

$Boxnumber =1

$BoxnumberMax = 3

;$MonsterIcon_out = PixelChecksum($MonIconSaveX,$MonIconSaveY, $MonIconSaveX+8, $MonIconSaveY+8)

ToolTip("Checkboxen gecached....", 0, 0)

While 1=1

;HöhenKontrolle

If $HoheCheckBox = PixelChecksum(93,239, 98, 245) Then

ToolTip("ZU HOCH! GEHE RUNTER", 0, 20)

$i=1

while $i<=30

$i=$i+1

Send("{PGDN}")

Sleep(100)

WEnd

EndIf

;wenn sich das Menu verschieben sollte, Restart

If NOT($MenuMoveCheckBox = PixelChecksum(840,126, 845, 131))Then

While (WinActive("http://www.xyz.org/index.php?action=Client&Client=0"))

WinKill("http://www.xyz.org/index.php?action=Client&Client=0", "")

Sleep(200)

WEnd

While (WinActive("XYZ"))

WinKill("XYZ", "")

Sleep(200)

WEnd

Sleep(1000*10)

Start()

EndIf

;Eigenes Schiff TOT??

If ($SchiffTot = PixelChecksum(453,170,558,198)) Then

While (WinExists("http://www.xyz.org/index.php?action=Client&Client=0"))

WinKill("http://www.xyz.org/index.php?action=Client&Client=0", "")

Sleep(200)

WEnd

While (WinExists("XYZ"))

WinKill("XYZ", "")

Sleep(200)

WEnd

Sleep(1000*10)

Start()

EndIf

;Flash10 Fehler?

If (WinExists("Internet Explorer", "hat ein Problem"))Then

Sleep(1000*60*5)

ToolTip("FLASH HAT EIN PROBLEM, VERSUCHE RESTART!", 0, 20)

While(WinExists("Internet Explorer") Or WinExists("leere Seite"))

WinKill("Internet Explorer")

WinKill("leere Seite")

Sleep(1500)

WEnd

Sleep(1500)

Start()

EndIf

;Sicher Zone?

If(PixelGetColor ( 530 , 278) = 6749953)Then

ToolTip("Sichere Zone erkannt - rausbewgen...", 0, 20)

$i=1

while $i<=30

$i=$i+1

Send("{PGUP}")

Sleep(100)

WEnd

;Send("M")

;Sleep(1000)

;MouseMove(507,342)

;MouseClick("left",507,342,1,0)

;Sleep(1000)

;MouseMove(500,524)

;MouseClick("left",500,524,1,0)

EndIf

;wenn Monsterfeld Pixel-Checksum der initialisierten Monsterfeld Pixel-Checksum entspricht, mach...

If $MonsterIcon_out = PixelChecksum($MonIconX,$MonIconY, $MonIconX+8, $MonIconY+8) Then

;die Maus über das Monsterfeld führen und zu testen ob Monster ansprechbar...

MouseMove($MonclickX,$MonclickY)

Sleep(1500)

;wenn das Monster ansprechbar ist, d.h. bei drüber bewegter Maus die Checksumme passt

If Not($MonsterIcon_out = PixelChecksum($MonIconX,$MonIconY, $MonIconX+8, $MonIconY+8)) Then

$i = 0

;während kein Kill

While ($MonsterKillCheckBox = PixelChecksum(950,662, 973, 668))

ToolTip(String($i), 0, 20)

;MouseClick("left",$ScreenCenterX,$ScreenCenterY,1,10)

MouseClick("left",$MonclickX,$MonclickY,1,0)

Sleep(100)

;HöhenKontrolle

If $HoheCheckBox = PixelChecksum(93,239, 98, 245) Then

ToolTip("ZU HOCH! GEHE RUNTER", 0, 20)

$i=1

while $i<=30

$i=$i+1

Send("{PGDN}")

Sleep(100)

WEnd

EndIf

If $i <50 Then

$i=$i+1

;böse while schleife kontrollieren

Else

$i=0

;ist es ein monster im target?

;MouseClick("left",$ScreenCenterX,$ScreenCenterY,3,10)

MouseMove($ScreenCenterX,$ScreenCenterY)

Sleep(300)

If Not($MonsterIcon_out = PixelChecksum($MonIconX,$MonIconY, $MonIconX+8, $MonIconY+8))Then

ToolTip("ES IST KEIN MONSTER IM TARGET, REINITIALISIERE...", 0, 20)

;reinitialisiere die Box

$Boxnumber =1

$MonclickY = 185

$MonIconY = 181

$MonsterKillCheckBox = -1

EndIf

;Eigenes Schiff TOT??

If ($SchiffTot = PixelChecksum(453,170,558,198)) Then

While (WinActive("http://www.xyz.org/index.php?action=Client&Client=0"))

WinKill("http://www.xyz.org/index.php?action=Client&Client=0", "")

Sleep(200)

WEnd

While (WinActive("XYZ"))

WinKill("XYZ", "")

Sleep(200)

WEnd

Sleep(1000*10)

Start()

EndIf

;Flash10 Fehler?

If (WinExists("Internet Explorer", "hat ein Problem"))Then

ToolTip("FLASH HAT EIN PROBLEM, VERSUCHE RESTART!", 0, 20)

Sleep(1000*60*5)

While(WinExists("Internet Explorer") Or WinExists("leere Seite"))

WinKill("Internet Explorer")

WinKill("leere Seite")

Sleep(1500)

WEnd

Sleep(1500)

Start()

EndIf

;reinitialisiere die Box - da wir davon ausgehen, dass das beschossene Monste am nähsten ist

$Boxnumber =1

$MonclickY = 185

$MonIconY = 181

EndIf

WEnd

;nach Kill setze KillCheckBoxSumme neu

$MonsterKillCheckBox = PixelChecksum(950,662, 973, 668)

;erhöhe Kills

;$Kills = $Kills +1

;If $Kills > 20 Then

; Start()

;EndIf

;reinitialisiere die Box

$Boxnumber =1

$MonclickY = 185

$MonIconY = 181

;klicke raus damit List sich aktualisiert

MouseClick("left",$ScreenCenterX,$ScreenCenterY,2,10)

Sleep(1000)

;falls Monster nicht ansprechbar, gehe zum nächsten Feld

Else

ToolTip("MONSTER NICHT ANSPRECHBAR, WEITER", 0, 0)

If ($Boxnumber > $BoxnumberMax) Then

$Boxnumber =1

$MonclickY = 185

$MonIconY = 181

Else

$Boxnumber =$Boxnumber+1

$MonclickY = $MonclickY+15

$MonIconY = $MonIconY+15

ToolTip($Boxnumber, 0, 20,"CHECKE NÄCHSTES FELD: ")

EndIf

;klicke raus damit List sich aktualisiert

MouseClick("left",$ScreenCenterX,$ScreenCenterY,2,10)

Sleep(1000)

;$MonKlickY = $MonKlickY + 15

EndIf

Else

ToolTip("KEIN MONSTER", 0, 0)

If ($Boxnumber > $BoxnumberMax) Then

$Boxnumber =1

$MonclickY = 185

$MonIconY = 181

Else

$Boxnumber =$Boxnumber+1

$MonclickY = $MonclickY+15

$MonIconY = $MonIconY+15

ToolTip($Boxnumber, 0, 20,"CHECKE NÄCHSTES FELD: ")

EndIf

;klicke raus damit List sich aktualisiert

MouseClick("left",$ScreenCenterX,$ScreenCenterY,2,0)

Sleep(1000)

;$MonKlickY = $MonKlickY + 15

EndIf

WEnd

EndFunc

Func ExitS()

Exit

EndFunc

Func TogglePause()

$Paused = NOT $Paused

While $Paused

sleep(100)

ToolTip('Script is "Paused"',0,0)

WEnd

ToolTip("")

EndFunc

Edited by sam007
Link to comment
Share on other sites

ok so i think, i just figured out, that AutoIt does not make the memory use grow that way - it seems to be an memory leak in the ActionScript of Flash of which the game is made.

So thx 4 your replies - this topic may be deleted :)

Edited by sam007
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...