Re: Different between ???.close and Set ??? = Nothing

From: augustus (augustus_at_discussions.microsoft.com)
Date: 09/28/04


Date: Tue, 28 Sep 2004 16:45:02 -0700

In the VBA IDE I always use the Toggle Breakpoint to test code, and I
frequently use it to stop the execution of code whenever I found a error.
Therefore, code never got a completed.
Would the garbage collector collect those objects or variables that got
referenced?

Is there way I could find RAM that locked up as the result of not freeing
resources (variables) up preoperly?

Thanks

"Jamie Collins" wrote:

> "Joe Fallon" wrote ...
>
> > The point of Nothing is to remove the reference to your object so it the RAM
> > can be freed up.
>
> If the object variable merely a pointer (reference) you'll only be
> releasing 4 bytes and I've yet to see code that sets explicitly
> empties all Long variables <g>. More importantly, though, you'll be
> decreasing the reference count so the actual object may be released
> (if this doesn't happen you'll get a memory leak). However, it is rare
> that an object variable needs to be explicitly set to nothing; simply
> let it go out of scope and let the garbage collector do its work. If
> you always set object variables to Nothing you risk obscuring the code
> that *needs* to set object variables to Nothing e.g. explicit teardown
> code to resolve circular references.
>
> Jamie.
>
> --
>



Relevant Pages

  • Re: Releasing Object Variables
    ... where object variables are not released when they go out ... is not going to create a problematic implicit reference, ... might run the risk of leaving an implicit variable. ... The longer I'm involved in computers professionally, ...
    (comp.databases.ms-access)
  • Re: Nothing Keyword Destories Objects rather than just resetting the variable to an empty variable
    ... undesired effect of the ByRef). ... cause of the local object variable of C was reference to the same ... Yes, an object variable is a pointer to an object, but that is the only ... Though I haven't fully tested it to be sure with object variables, ...
    (microsoft.public.excel.programming)
  • Re: Different between ???.close and Set ??? = Nothing
    ... If the object variable merely a pointer (reference) you'll only be ... releasing 4 bytes and I've yet to see code that sets explicitly ... you always set object variables to Nothing you risk obscuring the code ...
    (microsoft.public.access.modulesdaovba)
  • Re: Is setting to Nothing really necessary if procedure is about to end?
    ... The source of the problem was an implicitly created by reference ... control call with parens to force evaluation, ... Lyle has frequently pointed out that the ADO libraries don't have ... your ADO object variables. ...
    (comp.databases.ms-access)
  • Re: Anyone point to a tutorial on Collections and Classes
    ... It took me awhile to realize that ... > set it up as a dll. ... Only declare the object variables for your ... you can pass the reference from ...
    (microsoft.public.vb.general.discussion)

Quantcast