Click to See Complete Forum and Search --> : Dims


Aberf
May 11th, 2001, 07:35 AM
Is there a way to erase all the dims you currently have to free up memory?

coolbiz
May 11th, 2001, 07:55 AM
It depends on how you declare it. Consider the following:

In a module:

option Explicit

dim szPermanent as string
dim szArray() as string

Function Test1() as string
dim szPermanentInFunction as string
dim szArrayInFunction() as string

' step 1:
redim szArray(10)
redim szArrayInFunction(10)

' step 2:
redim szArrayInFunction(0)
End Function




Thus,
1. szPermanent cannot be removed as it is global to the module.
2. szPermanentInFunction will be removed when you exit from function Test1()
3. Step 1 will allocate string array with 22 members (11 for each array)
4. Step 2 will free up 11 members of the string array that were allocated in Step 1
5. szArrayInFunction array will be removed when you exit from function Test1()

-Cool Bizs