Re: " //Clean Up managed resources " f&*ck
- From: "Koliber (js)" <profesor_kinbote@xxxxxxxxxxxxxx>
- Date: 18 May 2007 14:33:24 -0700
Unmanaged code is such code that is not managed by the CLR.
Handles to files, windows etc. that obtained using unmanaged code
(e.g. by P/Invoke).
SqlConnection uses various of unmanaged code for it's implementation
of the underlying physical connection for example (socket connections,
named pipes etc..)
These kine of unmanaged resources are expensive so developers should
use the Dispose pattern to give the option of cleaning unmanaged
resources that are not in use in a deterministic way. Although it is
not necessary, it is very advisable to clean resources in a
deterministic way since GC is not deterministic.
Cheers,
Moty
If sql connection is managed resource
why dispose if called from finaliser in pattern above
should leave it untouched? I do not
understand! I was thinking that finaliser above
should guaraantee that dispose will be fired
if not called by hand by user of an object.
And if sql connection is unmanaged resource
what the hell is managed resource and how
it can be explicite free'd? :(
K
.
- Follow-Ups:
- 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
- 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
- " //Clean Up managed resources " f&*ck
- Prev by Date: Re: Events at Midnight
- Next by Date: Regex help
- Previous by thread: Re: " //Clean Up managed resources " f&*ck
- Next by thread: Re: " //Clean Up managed resources " f&*ck
- Index(es):
Relevant Pages
|