зеркало из https://github.com/mono/mail-archives.git
105 строки
3.9 KiB
HTML
105 строки
3.9 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE> [Mono-list] Dispose() method in the UdpClient class
|
|
</TITLE>
|
|
<LINK REL="Index" HREF="index.html" >
|
|
<LINK REL="made" HREF="mailto:jonpryor%40vt.edu">
|
|
<META NAME="robots" CONTENT="index,nofollow">
|
|
|
|
<LINK REL="Previous" HREF="016413.html">
|
|
<LINK REL="Next" HREF="016384.html">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#ffffff">
|
|
<H1>[Mono-list] Dispose() method in the UdpClient class
|
|
</H1>
|
|
<B>Jonathan Pryor
|
|
</B>
|
|
<A HREF="mailto:jonpryor%40vt.edu"
|
|
TITLE="[Mono-list] Dispose() method in the UdpClient class">jonpryor@vt.edu
|
|
</A><BR>
|
|
<I>Tue, 14 Oct 2003 19:38:46 -0400</I>
|
|
<P><UL>
|
|
<LI> Previous message: <A HREF="016413.html">[Mono-list] Dispose() method in the UdpClient class
|
|
</A></li>
|
|
<LI> Next message: <A HREF="016384.html">[Mono-list] Re: [DotGNU]Re: Collaboration on alternatives to
|
|
the US-patent-endangered APIs?
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#16416">[ date ]</a>
|
|
<a href="thread.html#16416">[ thread ]</a>
|
|
<a href="subject.html#16416">[ subject ]</a>
|
|
<a href="author.html#16416">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
<HR>
|
|
<!--beginarticle-->
|
|
<PRE>The difference between managed and unmanaged resources?
|
|
|
|
Managed == Memory
|
|
|
|
Unmanaged == Everything Else.
|
|
|
|
:<i>-)
|
|
</I>
|
|
It's perhaps not quite that clear cut, but it's close. A managed
|
|
resource is a resource that the runtime (1) knows about, and (2) is
|
|
responsible for allocating and cleaning up.
|
|
|
|
That pretty much leaves memory. File handles, Database connections, GUI
|
|
Windows... Everything of interest will (eventually) be an unmanaged
|
|
resource.
|
|
|
|
Now, there are patterns to help integrate unmanaged resources with the
|
|
memory garbage collector (finalizers, the IDisposable interface), but
|
|
they're not a complete solution. If you forget to Close/Dispose your
|
|
object, you'll leave the unmanaged resource open *at least* until the
|
|
next GC, which may be inappropriate.
|
|
|
|
(For one example of "inappropriate," database connections to commercial
|
|
databases are frequently limited to a small number -- due to licensing
|
|
issues -- so you don't want them open for long periods of time or you'll
|
|
kill performance. Thus, you *must* ensure that the connection is
|
|
disposed as soon as possible, or face a mob of dissatisfied customers.)
|
|
|
|
- Jon
|
|
|
|
On Tue, 2003-10-14 at 17:36, Met @ Uber wrote:
|
|
><i> On Tue, 2003-10-14 at 02:43, Gonzalo Paniagua Javier wrote:
|
|
</I>><i> > El mar, 14-10-2003 a las 08:11, Giuseppe Greco escribió:
|
|
</I>><i> >
|
|
</I>><i> > > 1. Isn't Socket a managed resource?
|
|
</I>><i> >
|
|
</I>><i> > The Socket class holds a socket, that is an unmanaged resource. That's
|
|
</I>><i> > why it's better to Close it explicitly instead of letting the GC do it.
|
|
</I>><i> >
|
|
</I>><i> > -Gonzalo
|
|
</I>><i> What's the difference between managed/unmanaged resources?
|
|
</I>><i> ...Just trying to learn.
|
|
</I>><i>
|
|
</I>><i> ~ Matthew
|
|
</I>><i>
|
|
</I>><i> _______________________________________________
|
|
</I>><i> Mono-list maillist - <A HREF="mailto:Mono-list@lists.ximian.com">Mono-list@lists.ximian.com</A>
|
|
</I>><i> <A HREF="http://lists.ximian.com/mailman/listinfo/mono-list">http://lists.ximian.com/mailman/listinfo/mono-list</A>
|
|
</I>
|
|
|
|
</PRE>
|
|
<!--endarticle-->
|
|
<HR>
|
|
<P><UL>
|
|
<!--threads-->
|
|
<LI> Previous message: <A HREF="016413.html">[Mono-list] Dispose() method in the UdpClient class
|
|
</A></li>
|
|
<LI> Next message: <A HREF="016384.html">[Mono-list] Re: [DotGNU]Re: Collaboration on alternatives to
|
|
the US-patent-endangered APIs?
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#16416">[ date ]</a>
|
|
<a href="thread.html#16416">[ thread ]</a>
|
|
<a href="subject.html#16416">[ subject ]</a>
|
|
<a href="author.html#16416">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
</body></html>
|