Re: Garbage collection in VBA

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



>Or is the memory allocated in the function returned to the heap when the
function goes out of scope?

For local variables, Yes.

--
Regards,
Tom Ogilvy

"Edward Ulle" <eulle@xxxxxxxxxxx> wrote in message
news:OBslzbkAGHA.3268@xxxxxxxxxxxxxxxxxxxxxxx
> I had read that its good practice to set instances of class to Nothing
> to free up the memory.
>
> Is there garbage collection in VBA?
>
> Also is there any benefit to setting Application Object Model class
> variables to Nothing upon exiting a procedure or function? For example
>
> Dim myRange as Range
>
> Set myRange = Something
>
> Do some code
>
> Set myRange = Nothing
>
> Exit Function
>
> Or is the memory allocated in the function returned to the heap when the
> function goes out of scope?
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***


.



Relevant Pages

  • Re: Blocks for scope control
    ... We already use restrictive variable scoping in blocks; ... you do want to "enforce temporariness" of a variable in a scope narrower ... hence so many local variables that you want to use blocks to introduce ...
    (comp.lang.java.programmer)
  • Re: Pyserial again
    ... Richie Hindle wrote: ... at this point we're getting into application design issues unless and until Luca can learn enough Python and other programming stuff to understand why "ser" is "going out of scope" ... If you don't know about object construction and destruction, memory allocation and garbage collection, the concept of "scope" and the difference between things like local variables, global variables, and attributes, we're going to continue to have an exceptionally difficult and frustrating time helping you. ...
    (comp.lang.python)
  • Re: To Hungarian or not to Hungarian
    ... prefix that denotes whether the item is a parameter, ... The type, but not the scope. ... I personally do not use prefixes for local variables. ... "Death is one of the few things that can be done as easily lying ...
    (borland.public.delphi.non-technical)
  • Re: Pass by reference and copy on write
    ... BC> possible to eval code which affects local variables in other scopes. ... gives you access to the current local variable scope. ... inc_a {puts "Hello"} ... Another way to persist an activation record is to create a "closure". ...
    (comp.lang.ruby)
  • Re: VB 6.0 Desktop - Global Variables
    ... variables are not "slower" than local variables. ... wide scope", then this kind of variables only can live in a module. ... standard code module. ... without needing a reference to an object. ...
    (microsoft.public.vb.general.discussion)