Re: "using" vs "= null" and object lifetime
From: Jon Skeet [C# MVP] (skeet_at_pobox.com)
Date: 02/17/05
- Next message: Jon Skeet [C# MVP]: "Re: throws keyword missing in C#"
- Previous message: Jon Skeet [C# MVP]: "Re: "using" vs "= null" and object lifetime"
- In reply to: Nicholas Paldino [.NET/C# MVP]: "Re: "using" vs "= null" and object lifetime"
- Next in thread: Ollie Riches: "Re: "using" vs "= null" and object lifetime"
- Reply: Ollie Riches: "Re: "using" vs "= null" and object lifetime"
- Reply: Jon Skeet [C# MVP]: "Re: "using" vs "= null" and object lifetime"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 17 Feb 2005 18:02:09 -0000
Nicholas Paldino [.NET/C# MVP] <mvp@spam.guard.caspershouse.com> wrote:
> > void SomeFunc()
> > {
> > MyClass c = new MyClass();
> > c.CallSomeOtherFunc();
> > c = null;
> > }
>
> This depends on how it is compiled. If you are compiling in debug mode,
> then yes, it will make it GC faster (although how much faster is
> questionable since c would have been released very quickly afterwards, due
> to exiting the method). The reason for this is that code compiled in debug
> mode will not have references released when they are no longer used.
Are you sure it's a case of how it's compiled? I was under the
impression that it was how it was being *run* - which would make sense,
as if you're not running in the debugger, you don't need to know the
value of c after the last use even if the debug symbols are present.
When I get the chance I may test this in each configuration just to see
what happens...
-- Jon Skeet - <skeet@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
- Next message: Jon Skeet [C# MVP]: "Re: throws keyword missing in C#"
- Previous message: Jon Skeet [C# MVP]: "Re: "using" vs "= null" and object lifetime"
- In reply to: Nicholas Paldino [.NET/C# MVP]: "Re: "using" vs "= null" and object lifetime"
- Next in thread: Ollie Riches: "Re: "using" vs "= null" and object lifetime"
- Reply: Ollie Riches: "Re: "using" vs "= null" and object lifetime"
- Reply: Jon Skeet [C# MVP]: "Re: "using" vs "= null" and object lifetime"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|