Jump to content

Best effective way to erase empty array


Go to solution Solved by mikell,

Recommended Posts

Posted

hi, I am just wondering if I am doing this right I been emptying arrays like this

$myarray = null

but I also sometimes been using 

Redim $myarray[0]

so what is the best way to make sure it totally cleared from memory.

Thanks.

On Error Resume Pulling Hair Out.

Posted

Func _ArrayErase(ByRef $aRRAY)
    Local $aTemp[0]
    $aRRAY = $aTemp
EndFunc

??

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

  • Solution
Posted

As said in the helpfile (Keyword reference > Dim / Global / Local / Const) :

" To erase an array (maybe because it is a large global array and you want to free the memory), simply assign a single value to it:
$aArray = 0
This will free the array and convert it back to the single value of 0.

Declaring the same variable name again will erase all array values and reset the dimensions to the new definition."

Posted
  On 9/22/2014 at 6:47 PM, mikell said:

Glad I could help the helpfile could help  :)

Well said :)

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

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