Memory Management Question

T

TT

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

Anand.V.V.N

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
 
J

Jezebel

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top