CasaCorupta Posted August 1, 2007 Share Posted August 1, 2007 Hello First time I visit the Forum an asking for help. I wrote a script which makes huges Problems with the virtual memory. I am a starter at AUTO IT, can you tell me why my memory goes up and up. After a "little" while there comes the Error Message "allocating memory". Thanks for your help... expandcollapse popup;---------------------------------------------------------------------------- ; Definition der Variablen #include <file.au3> #include <Array.au3> DIM $netbiosname_file $netbiosname_file = ("netbiosname_file.txt") DIM $netbiosuser_file $netbiosuser_file = ("netbiosuser_file.txt") DIM $user_file $user_file = ("user_file.txt") DIM $workdir $workdir = ("D:\") $c = 1 While $c ;------------------------------------------------------------------------------- ; erzeugen der NetBiosName File $CMD = ( "netstat -o > " & $netbiosname_file) RunWait(@ComSpec & " /c " & $CMD, $workdir, @SW_HIDE) ;------------------------------------------------------------------------------- ; selektieren des NetBiosName $count_name=_FileCountLines($netbiosname_file) $netbiosname_file_open = FileOpen($netbiosname_file, 0) For $i=1 To $count_name Step 1 $line = Filereadline($netbiosname_file_open, $i) If NOT StringInStr($line,"8100")=0 Then $array=StringSplit($line,".") $VAR1=($array[1]) $INVNR=StringRight ($VAR1, 10) ;------------------------------------------------------------------------------- ; erzeugen der NETBiosUser File $CMD = ( "nbtstat -a " & $INVNR & " >>" & $netbiosuser_file) RunWait(@ComSpec & " /c " & $CMD, $workdir, @SW_HIDE) ;------------------------------------------------------------------------------- EndIf Next FileClose($netbiosname_file_open) ;------------------------------------------------------------------------------- ; selektieren des NetBiosUser $netbiosuser_file_open = FileOpen($netbiosuser_file, 0) For $i=1 To 100 Step 1;Dokument wird nur mit 17 Zeilen angegeben, stimmt aber nicht $line_user = Filereadline($netbiosuser_file_open, $i) If NOT StringInStr($line_user,"<03>")=0 Then $array=StringSplit($line_user,"<") $VAR2=($array[1]) ;------------------------------------------------------------------------------- ; erzeugen der User File $user_file_open = FileOpen($user_file, 1) Filewriteline($user_file_open, $VAR2) FileClose($user_file_open) ;------------------------------------------------------------------------------- EndIf Next FileClose($netbiosuser_file_open) ;------------------------------------------------------------------------------- ; löschen der Dateien Sleep(2000) FileDelete($netbiosname_file) Sleep(2000) FileDelete($netbiosuser_file) Sleep(60000) FileDelete($user_file) $c = $c +1 WEnd Greets CasaCorupta Link to comment Share on other sites More sharing options...
DW1 Posted August 1, 2007 Share Posted August 1, 2007 keep any of these: Filereadline() FileWrite() FileWriteLine() Out of your loop, they leak memory. Load them into a variable once in the beginning. I wish this would get fixed. AutoIt3 Online Help Link to comment Share on other sites More sharing options...
CasaCorupta Posted August 2, 2007 Author Share Posted August 2, 2007 thx i will try it... Greets CasaCorupta 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