LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default VBA memory allocation

Ok guys.

I did something that I should have done hours ago: i made some simple
programs to test the memory mechanics in VBA.

It turns out that coll.remove(index) also frees memory of the object at
'index' PROVIDED THAT nothing else refers to the object. In fact coll=nothing
also does this. My memory isnt getting freed as something else is pointing to
the object i'm try to free. And i'll be spending the rest of this nice day
look for that.

Thanks for all ur help.
Vivek.

"vivmaha" wrote:

Hi,

I'm running a huge model on VBA, and I think i'm leaking memory.

In the following example, does the memory allocated for myInstance get freed
when I remove it from the collection? I assume that, like java, once the
memory is not referenced to, It gets deallocated.

dim myCollection as Collection
Set myCollection = new Collection
dim myInstance as MyClass
Set myInstance = new MyClass
myCollection.add myInstance
myCollection.remove 1

If the above does not free the memory, how do I do it?

Also, does VBA have constructors? And destructors?

Thanks.

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
XL 2007 - Out of Memory - memory leak/bug? PCLIVE Excel Discussion (Misc queries) 0 March 23rd 09 03:31 PM
Allocation JMI Excel Discussion (Misc queries) 0 February 10th 09 05:49 PM
Allocation Dinesh Excel Worksheet Functions 4 June 28th 07 10:06 PM
XLL Memory allocation problem Nat[_4_] Excel Programming 0 March 6th 06 11:04 AM
F-key allocation HELLBOY787 Excel Discussion (Misc queries) 1 June 30th 05 11:21 AM


All times are GMT +1. The time now is 06:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"