DLW Posted March 30, 2010 Share Posted March 30, 2010 I have an AutoIt script that uses a FileFindFirstFile and FileFindNextFile in a loop where the variable used is redefined. What I've noticed is that the machine which is running this script (XP SP3) works fine but eventually it runs out of resources. Procexp seems to show that for each declaration of $search in my script the connection is retained to the file scructure and the running script just grows its memory accordingly. Is there any way of making sure connections are properly release and/or have I missed something out in a delcaration. $search is not predefined. This is a part of my script: $search = FileFindFirstFile($source & '\' & $wdir & '\schedule\*++++*') if $search <> -1 Then While 1 $file = FileFindNextFile($search) if @error then ExitLoop $x=$x+1 redim $files1[$x] $files1[$x-1]=$file WEnd EndIf _ArraySort($files1) $x=0 Redim $files2[1] $files2[0]='' $search = FileFindFirstFile($dest & '\' & $wdir & '\schedule\*++++*') if $search <> -1 Then While 1 $file = FileFindNextFile($search) if @error then ExitLoop $x=$x+1 redim $files2[$x] $files2[$x-1]=$file WEnd EndIf Link to comment Share on other sites More sharing options...
DLW Posted March 30, 2010 Author Share Posted March 30, 2010 Of course, no sonner had I posted this than I realised what was missing. I needed to do a FileClose($search) at the end of each usage - problem now gone away. 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