Jump to content

Recommended Posts

Posted

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.

Posted

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..?

Posted

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

Posted

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 says

If 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 (¢) (¢).

Posted

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 :)

Posted

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

Posted

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 :)

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
  • Recently Browsing   0 members

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