Click to See Complete Forum and Search --> : Erasing Arrays


forty7
May 23rd, 2001, 12:50 PM
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

phunkydude
May 23rd, 2001, 01:28 PM
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.

forty7
May 23rd, 2001, 01:32 PM
That doesn't sound right. It's a fixed size array so it can't be redimed.

thanx/good luck,
adam

phunkydude
May 23rd, 2001, 01:44 PM
Oops, should READ the problem!

Still try see if the individual elements are terminated.

Otherwise switch to a dynamic array.

forty7
May 23rd, 2001, 01:48 PM
Thanks. I'll put a break point in the terminate event for the object and test it.

thanx/good luck,
adam