views:

362

answers:

1

If I have a variant array which holds nothing but simple types, and possible further variant arrays of simple types, do I need to do anything explicit to free memory, or is it all taken care of for me. I've always thought there is nothing to do, but I just had a slight doubt!

+7  A: 

Variants are managed types. They're owned by the compiler's reference-counting system and don't need to be freed manually.

If you do something convoluted like typecasting an object to an integer and storing that in the variant, and then making that the only reference to your object, then you'll want to clean that up before the variant goes out of scope, but the variant itself (including variant arrays) is safe.

Mason Wheeler
that's what I thought, but sometimes you need a little backup!
Steve