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

Thread: Erasing Arrays

  1. #1
    Join Date
    Apr 2001
    Location
    CA
    Posts
    153

    Erasing Arrays

    I have a fixed array of objects (class I created) that I use in an Active X control. In the terminate event, I want to free the memory used by the array.
    Currently, I'm using the Erase function. According to the VB help the Erase function "Sets each element to the special value Nothing." This sounds good, but what about the memory the array uses itself? Is this taken care of automatically, or should I Erase the array AND set it to nothing?

    thanx/good luck,
    adam
    thanx/good luck

  2. #2
    Join Date
    Aug 2000
    Location
    Namibia
    Posts
    139

    Re: Erasing Arrays

    I think erase should work fine. It redimensions the vector back to zero elements. If you want to make sure check that each of the elements in the array terminate or not. Let me know plz.


  3. #3
    Join Date
    Apr 2001
    Location
    CA
    Posts
    153

    Re: Erasing Arrays

    That doesn't sound right. It's a fixed size array so it can't be redimed.

    thanx/good luck,
    adam
    thanx/good luck

  4. #4
    Join Date
    Aug 2000
    Location
    Namibia
    Posts
    139

    Re: Erasing Arrays

    Oops, should READ the problem!

    Still try see if the individual elements are terminated.

    Otherwise switch to a dynamic array.


  5. #5
    Join Date
    Apr 2001
    Location
    CA
    Posts
    153

    Re: Erasing Arrays

    Thanks. I'll put a break point in the terminate event for the object and test it.

    thanx/good luck,
    adam
    thanx/good luck

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