I have some VBA code that gets run within Word in which the user clicks a
menu selection (a macro launched from a toolbar). Every time the code runs,
a collection is created and populated with freshly created instances of a
class. When the macro ends, I do not have any cleanup code to set the class
instances or the collection to nil. Will this leak memory?
Anand.V.V.N - 20 Jul 2005 06:40 GMT
Hi,
The safest way to detect is to check the memory free before and after the
macro execution. It safe to have a clean up code always, you never know. When
you quit word it, memory may be cleared automatically, but its safe to have a
clean up code in palce always.
Anand

Signature
"Who will guard the guards?"
> I have some VBA code that gets run within Word in which the user clicks a
> menu selection (a macro launched from a toolbar). Every time the code runs,
> a collection is created and populated with freshly created instances of a
> class. When the macro ends, I do not have any cleanup code to set the class
> instances or the collection to nil. Will this leak memory?
Jezebel - 20 Jul 2005 09:31 GMT
No. Provided the collection objects are not self-referential, they are
cleared when the collection variable falls out of scope.
>I have some VBA code that gets run within Word in which the user clicks a
>menu selection (a macro launched from a toolbar). Every time the code runs,
>a collection is created and populated with freshly created instances of a
>class. When the macro ends, I do not have any cleanup code to set the class
>instances or the collection to nil. Will this leak memory?