Erase Statement
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Erase Statement

Used to release array variables and deallocate the memory used for their elements.

Erase arraylist

Parts

arraylist
Required. List of array variables to be erased. Multiple variables are separated by commas.

Remarks

The Erase statement can appear only at procedure level. This means you can release arrays inside a procedure but not at class or module level.

The Erase statement is equivalent to assigning Nothing to each array variable.

Example

This example uses the Erase statement to clear two arrays and free their memory (1000 and 100 storage elements respectively). The ReDim statement then assigns a new array instance to the three-dimensional array.

Dim Int3DArray(9, 9, 9), Int2DArray(9, 9) As Integer
' ...
Erase Int3DArray, Int2DArray
' ...
ReDim Int3DArray(4, 4, 9)

See Also

Nothing | ReDim Statement

Show:
© 2016 Microsoft