Re: " //Clean Up managed resources " f&*ck
- From: "Koliber (js)" <profesor_kinbote@xxxxxxxxxxxxxx>
- Date: 19 May 2007 04:03:31 -0700
On 19 Maj, 11:43, Moty Michaely <Moty...@xxxxxxxxx> wrote:
On May 19, 12:33 am, "Koliber (js)" <profesor_kinb...@xxxxxxxxxxxxxx>
wrote:
If sql connection is managed resource
why dispose if called from finaliser in pattern above
should leave it untouched?
The finalizer is called by the GC. Implementing a finalizer is the
only way to code things that needs to be done at instance collection
time (such as releasing internal unmanaged resources). Since Dispose
methods is responsible for cleaning resources, the finalizer code
usually calls the Dispose method.
Therefore, you are right - it's there to guarantee object disposal if
not called manually. But, again, the GC is not deterministic. The
finalizar can practically call the finalizer 10 minutes after it
really got pinned off... Therefore, manual disposal is a best practice
to make sure that unmanaged resources will not be held for 10 minutes,
for nothing....
And if sql connection is unmanaged resource
what the hell is managed resource and how
it can be explicite free'd? :(
Quote: "In Microsoft Windows terminology, managed code is computer
instructions - that is, "code" - executed by a CLI-compliant virtual
machine, such as Microsoft's .NET Framework Common Language Runtime,
or other CLI implementations from The Mono Project or the DotGNU
Project."
Taken from:http://en.wikipedia.org/wiki/Managed_code
Therefore, SqlConnection is a managed code that uses unmanaged
resources.
Hope this clears things..
Moty
Sorry but not at all :( - my question I am putting all the time is
not
about managed code (all things you said i do know)
it is about 'managed resource'. What the hell it is? and how is
method
of clearing it? (see dispose pattern in 1st post there are two areas
for cleaning code one for unmanaged resources (clear for me i think -
like
sql connection) and second for the managed resource cleaning i do not
know
what it is.
--
test
.
- Follow-Ups:
- Re: " //Clean Up managed resources " f&*ck
- From: Moty Michaely
- Re: " //Clean Up managed resources " f&*ck
- References:
- " //Clean Up managed resources " f&*ck
- From: Koliber (js)
- Re: " //Clean Up managed resources " f&*ck
- From: Nicholas Paldino [.NET/C# MVP]
- Re: " //Clean Up managed resources " f&*ck
- From: Koliber (js)
- Re: " //Clean Up managed resources " f&*ck
- From: Moty Michaely
- Re: " //Clean Up managed resources " f&*ck
- From: Koliber (js)
- Re: " //Clean Up managed resources " f&*ck
- From: Moty Michaely
- " //Clean Up managed resources " f&*ck
- Prev by Date: Re: class inherited, what about its resources(particually imageList)
- Next by Date: Re: " //Clean Up managed resources " f&*ck
- Previous by thread: Re: " //Clean Up managed resources " f&*ck
- Next by thread: Re: " //Clean Up managed resources " f&*ck
- Index(es):
Relevant Pages
|