Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / July 2005

Tip: Looking for answers? Try searching our database.

Memory Management Question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
TT - 19 Jul 2005 22:56 GMT
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?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.