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?

RE: Memory Management Question by AnandVVN

AnandVVN
Wed Jul 20 00:40:02 CDT 2005

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
--
"Who will guard the guards?"


"TT" wrote:

> 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?
>
>
>

Re: Memory Management Question by Jezebel

Jezebel
Wed Jul 20 03:31:56 CDT 2005

No. Provided the collection objects are not self-referential, they are
cleared when the collection variable falls out of scope.


"TT" <.> wrote in message news:PsWdnQJ29cBr60DfRVn-oA@comcast.com...
>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?
>