trademaid Posted May 13, 2008 Posted May 13, 2008 I have a script that runs in a loop every 2 seconds. after about 8 hours the screen starts flashing, like the os has crashed. I have to end taskt the auoitexe to fix it. the script contains the following commands and some loops (just snippets of the code) $PublicIP = _GetIP() ProgressSet($xy*100,$bitecount-$oldbytecount & " div " & $minbytecount) ProgressOn("T%rafic" & $version &":" & _GetIP() & " FailCount " & $failcount, "TRaffic:" & $minbytecount, @sec & "sec percent",1620,110,16) do $rc=_Rundos("netstat -e > c:\temp\netstatoute.txt") $file1txt = FileRead('c:\temp\netstatoute.txt', FileGetSize('c:\temp\netstatoute.txt')) I am on version v3.2.12.0 any idea how to tell whats wrong. Perhaps a memory leak etc. Its beyond me.
Zedna Posted May 13, 2008 Posted May 13, 2008 It may be really bug. Post whole reproducing script. Your posted code seems to be only part of script. Resources UDF ResourcesEx UDF AutoIt Forum Search
nobbe Posted May 13, 2008 Posted May 13, 2008 hi try to watch the memory consumption in task-manager- processes when it appears to consume more and more memory try to narrow that down in the script - maybe an edit control - maybe a variable array growing..?
trademaid Posted May 14, 2008 Author Posted May 14, 2008 Here is the cut down script. The screen flashes and is crashed when the counter gets just under 10,000. Memory grows by 1 few kb over this time. Anyone got any idea on the problem? $version="10l" $minbytecount=0 ; if trafic below this we change over $filename="c:\log\failover.txt" $file = FileOpen($filename, 1) FileWriteLine($file,@hour & @min & @sec & " start" & @CRLF) FileClose($file) $startbytecount=0; $bytecount=0; $oldbytecount=0 $xy=0 $file="c:\netstats.txt" $div=1 $cable=-1 $i=0 $pid=0 $failcount=0 #include <Math.au3> #include <Process.au3> #include <Inet.au3> $PublicIP = _GetIP() ;SoundPlay("c:\alertmon\ahooga.wav",1) ProgressOn("T%rafic" & $version &":" & _GetIP() & " FailCount " & $failcount, "TRaffic:" & $minbytecount, @sec & "sec percent",20,110,16) $counter=0 ;do $counter=$counter+1 for $c2=0 to 20000 ProgressOn("TRAFFIC" & $version &":" & $PublicIP & " FailCount " & $failcount & " Cable:" & $cable, "TRaffic:" & $minbytecount, @sec & "sec percent: " & $c2,20,110,16) ProgressSet($xy*100,$c2) sleep(5) Next ;sleep(10000) ;until $i=-3
ACS Posted May 14, 2008 Posted May 14, 2008 Perhaps you should be using ProgressSet instead of ProgressOn. According to the help file...ProgressOn Creates a customizable progress bar window.I realize the help file also saysIf ProgressOn is called while a progress window already exists, the window is redrawn/moved. (If you want multiple simultaneous progress windows, you need to use multiple scripts.)but I'm not sure if the developers took into consideration the number of times this function is being called. It COULD be a memory leak with the AutoIt engine.Just my (¢) (¢).
enaiman Posted May 14, 2008 Posted May 14, 2008 I don't know why it crashes on your computer - I just ran your script to 100% I've only modified your progress part to optimize it (no more blinking, seconds displayed accordingly, progress set accordingly) $version="10l" $minbytecount=0 ; if trafic below this we change over $filename="c:\log\failover.txt" $file = FileOpen($filename, 1) FileWriteLine($file,@hour & @min & @sec & " start" & @CRLF) FileClose($file) $startbytecount=0; $bytecount=0; $oldbytecount=0 $xy=0 $file="c:\netstats.txt" $div=1 $cable=-1 $i=0 $pid=0 $failcount=0 #include <Math.au3> #include <Process.au3> #include <Inet.au3> $PublicIP = _GetIP() ProgressOn("TRAFFIC" & $version &":" & $PublicIP & " FailCount " & $failcount & " Cable:" & $cable, "TRaffic:" & $minbytecount, @sec & "sec percent: " ,20,110,16) for $c2=0 to 20000 If $c2=0 Then $start_timer = TimerInit() $xy += 0.005 $xy = Round($xy, 3) $seconds = Round(TimerDiff($start_timer)/1000, 0) ProgressSet($xy,$seconds & " sec, percent: " & $xy) sleep(5) Next SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :)
trademaid Posted May 14, 2008 Author Posted May 14, 2008 thanks for your help if the ProgressOn("TRAFFIC" & $version &":" & $PublicIP & " FailCount " & $failcount & " Cable:" & $cable, "TRaffic:" & $minbytecount, @sec & "sec percent: " & $c2,20,110,16) is removed, the error goes away. It seems some sort of memory leak etc happens when we do 10,000 of these. your script works fine, as does mine when I remove this line from the loop
enaiman Posted May 14, 2008 Posted May 14, 2008 Glad you're happy about the result You don't need that line inside the loop: you need to create once the progress and after that only to update it, that's why I took it out of the loop. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :)
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