Jump to content

Variable is not releasing connection to directory


DLW
 Share

Recommended Posts

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

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