Re: In need of .NET advocacy
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Fri, 1 Apr 2005 18:36:02 +0100
Alex <response@xxxxxxxxxxxxx> wrote:
> The reason that I mentioned it in the first place is that I think
> that GC is not the main reson to switch to .NET and in our case,
> since some of our developers have been bitten by blindly relying on
> the Java GC, it is not even a "good" reason.
It's a very good reason - so long as you know what you're doing. Like
almost any other technology, you need to know what it's capable of and
what it's not capable of. It's wonderful when it comes to memory, but
awful for unmanaged resources - so don't use it for unmanaged
resources.
The "using" statement makes disposing of unmanaged resources in C# very
easy for the most part (when you don't need to embed them in objects
themselves) and the disposable pattern makes it easy to extend to the
rarer cases.
You've cited cases where Java developers have assumed that the GC can
cope with non-memory resources in a timely fashion - my counter-example
is that there are plenty of C++ programs which leak memory and wouldn't
if they used GCs. (Yes, there are GCs available for C++, but again you
end up with a particular "dialect" of C++ rather than "plain" C++.) The
GC should only be used to deal with memory, but I find that memory is
the resource I use most often.
--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
.
- Follow-Ups:
- Re: In need of .NET advocacy
- From: Alex
- Re: In need of .NET advocacy
- References:
- Re: In need of .NET advocacy
- From: Alex
- Re: In need of .NET advocacy
- From: Nick Malik [Microsoft]
- Re: In need of .NET advocacy
- From: Alex
- Re: In need of .NET advocacy
- From: Nick Malik [Microsoft]
- Re: In need of .NET advocacy
- From: Cor Ligthert
- Re: In need of .NET advocacy
- From: Alex
- Re: In need of .NET advocacy
- Prev by Date: Re: In need of .NET advocacy
- Next by Date: Re: Visual studio denying access to database in Server Explorer
- Previous by thread: Re: In need of .NET advocacy
- Next by thread: Re: In need of .NET advocacy
- Index(es):
Relevant Pages
|