tags:

views:

22

answers:

1

I am storing a jagged array of numbers in approximately the following way...

Dim mainarray() as Variant
Dim smallarray() as Integer

ReDim mainarray(fairly_large_size)

For i = 1 to fairly_large_size
    ReDim smallarray(some_variable_moderate_size)
    'fill in smallarray
    mainarray(i) = smallarray
Next i

The question is, when I come to erase the main array, is erasing that array sufficient to reclaim all the memory involved in it, or do I have to erase each of its elements first?

+2  A: 

If you did, VB would somewhat failed its purpose :)

No, erasing the outer array is fine. Whatever is inside (could also be COM objects for instance) will be released properly.

GSerg
@GSerg, Thank you. I'm more used to languages where you have to look after this sort of thing yourself.
Brian Hooper