CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Dims

  1. #1
    Join Date
    May 2001
    Posts
    24

    Dims

    Is there a way to erase all the dims you currently have to free up memory?


  2. #2
    Join Date
    Feb 2001
    Location
    Stamford CT USA
    Posts
    2,167

    Re: Dims

    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

    Good Luck,
    -Cool Bizs

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured