<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Clearing up some confusion over finalization and other areas in GC</title><link>http://blogs.msdn.com/maoni/archive/2004/11/04/252697.aspx</link><description>In the WinDev conference that I just went to, there seems to be some confusion over finalization (such as why it even exists and etc) and other areas. I hope the following will clear up that confusion. If not, let me know. Finalization 1) Why we have</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>GC and Finalization</title><link>http://blogs.msdn.com/maoni/archive/2004/11/04/252697.aspx#252758</link><pubDate>Fri, 05 Nov 2004 11:49:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:252758</guid><dc:creator>Avnrao's Blog</dc:creator><description>GC and Finalization</description></item><item><title>OTC Links For November 6</title><link>http://blogs.msdn.com/maoni/archive/2004/11/04/252697.aspx#253449</link><pubDate>Sun, 07 Nov 2004 03:39:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:253449</guid><dc:creator>OdeToCode Link Blog</dc:creator><description /></item><item><title>Maoni:Clearing up some confusion over finalization and other areas in GC</title><link>http://blogs.msdn.com/maoni/archive/2004/11/04/252697.aspx#253916</link><pubDate>Mon, 08 Nov 2004 19:02:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:253916</guid><dc:creator>Sam Gentile's Blog</dc:creator><description /></item><item><title>Just like your Mother: The Garbage Collector</title><link>http://blogs.msdn.com/maoni/archive/2004/11/04/252697.aspx#254233</link><pubDate>Tue, 09 Nov 2004 06:12:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:254233</guid><dc:creator>Jason Alexander's Site</dc:creator><description /></item><item><title>Maoni:Clearing up some confusion over finalization and other areas in GC</title><link>http://blogs.msdn.com/maoni/archive/2004/11/04/252697.aspx#254431</link><pubDate>Tue, 09 Nov 2004 17:39:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:254431</guid><dc:creator>Sam Gentile's Blog</dc:creator><description /></item><item><title>New and Notable 68</title><link>http://blogs.msdn.com/maoni/archive/2004/11/04/252697.aspx#328486</link><pubDate>Tue, 21 Dec 2004 14:33:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:328486</guid><dc:creator>Sam Gentile's Blog</dc:creator><description /></item><item><title>New and Notable 68</title><link>http://blogs.msdn.com/maoni/archive/2004/11/04/252697.aspx#329110</link><pubDate>Tue, 21 Dec 2004 22:51:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:329110</guid><dc:creator>Sam Gentile's Blog</dc:creator><description /></item><item><title>Special threads in CLR</title><link>http://blogs.msdn.com/maoni/archive/2004/11/04/252697.aspx#438066</link><pubDate>Tue, 12 Jul 2005 21:32:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:438066</guid><dc:creator>Yun Jin's WebLog</dc:creator><description>Question: How many threads does a typical managed process have when it just starts to run?&amp;amp;amp;nbsp;&amp;amp;amp;nbsp;...</description></item><item><title>Garbage Collection Articles: an updated list</title><link>http://blogs.msdn.com/maoni/archive/2004/11/04/252697.aspx#443596</link><pubDate>Wed, 27 Jul 2005 00:52:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:443596</guid><dc:creator>Steve Hebert's Development Blog</dc:creator><description>I previously blogged about a set must-read garbage collection articles&amp;amp;amp;nbsp;and issues around directly...</description></item><item><title>How many threads does a typical managed process have when it just starts to run?</title><link>http://blogs.msdn.com/maoni/archive/2004/11/04/252697.aspx#453128</link><pubDate>Thu, 18 Aug 2005 19:33:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:453128</guid><dc:creator>C#, VS Deployment and all geek talk</dc:creator><description /></item><item><title>Special threads in CLR</title><link>http://blogs.msdn.com/maoni/archive/2004/11/04/252697.aspx#457332</link><pubDate>Sun, 28 Aug 2005 22:44:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:457332</guid><dc:creator>Yun Jin's WebLog</dc:creator><description>Question: How many threads does a typical managed process have when it just starts to run?&amp;amp;amp;nbsp;&amp;amp;amp;nbsp;...</description></item><item><title>re: Clearing up some confusion over finalization and other areas in GC</title><link>http://blogs.msdn.com/maoni/archive/2004/11/04/252697.aspx#1862701</link><pubDate>Mon, 12 Mar 2007 09:23:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1862701</guid><dc:creator>...</dc:creator><description>&lt;p&gt;Nice site you have!&lt;/p&gt;</description></item><item><title>re: Clearing up some confusion over finalization and other areas in GC</title><link>http://blogs.msdn.com/maoni/archive/2004/11/04/252697.aspx#1896401</link><pubDate>Fri, 16 Mar 2007 23:58:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1896401</guid><dc:creator>...</dc:creator><description>&lt;p&gt;pagine piuttosto informative, piacevoli =)&lt;/p&gt;</description></item><item><title>Top 20 .NET Garbage Collection (GC) Articles</title><link>http://blogs.msdn.com/maoni/archive/2004/11/04/252697.aspx#3452762</link><pubDate>Fri, 22 Jun 2007 07:40:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3452762</guid><dc:creator>roy ashbrook</dc:creator><description>&lt;p&gt;Ah. Garbage Collection... how I love and hate thee. =P I think one sad thing about programming in .net&lt;/p&gt;
</description></item><item><title>Top 20 .NET Garbage Collection (GC) Articles</title><link>http://blogs.msdn.com/maoni/archive/2004/11/04/252697.aspx#3452791</link><pubDate>Fri, 22 Jun 2007 07:43:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3452791</guid><dc:creator>roy ashbrook</dc:creator><description>&lt;p&gt;Ah. Garbage Collection... how I love and hate thee. =P I think one sad thing about programming in .net&lt;/p&gt;
</description></item><item><title>Dispose Pattern and Object Lifetime [Brian Grunkemeyer]</title><link>http://blogs.msdn.com/maoni/archive/2004/11/04/252697.aspx#5782501</link><pubDate>Tue, 30 Oct 2007 19:00:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5782501</guid><dc:creator>Noticias externas</dc:creator><description>&lt;p&gt;The Dispose pattern is the way to think of object lifetime in the .NET Framework. Admittedly, it can&lt;/p&gt;
</description></item><item><title>The Achilles Thread</title><link>http://blogs.msdn.com/maoni/archive/2004/11/04/252697.aspx#6386128</link><pubDate>Mon, 19 Nov 2007 05:42:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6386128</guid><dc:creator>Andreas Zenker - My OBJECTive Opinion</dc:creator><description>&lt;p&gt;&amp;quot;[when debugging] If you see hoof prints think horses, not zebras&amp;quot;. Hunt and Thomas, in The Pragmatic...&lt;/p&gt;
</description></item><item><title>   [??????]??????Top 20 .NET Garbage Collection (GC) ??????  : ????????????????????? TAHETA.ORG</title><link>http://blogs.msdn.com/maoni/archive/2004/11/04/252697.aspx#9249914</link><pubDate>Tue, 23 Dec 2008 15:43:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9249914</guid><dc:creator>   [??????]??????Top 20 .NET Garbage Collection (GC) ??????  : ????????????????????? TAHETA.ORG</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.taheta.org/?p=94"&gt;http://www.taheta.org/?p=94&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>When is Finalize called? | keyongtech</title><link>http://blogs.msdn.com/maoni/archive/2004/11/04/252697.aspx#9361182</link><pubDate>Thu, 22 Jan 2009 04:35:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9361182</guid><dc:creator>When is Finalize called? | keyongtech</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.keyongtech.com/451497-when-is-finalize-called"&gt;http://www.keyongtech.com/451497-when-is-finalize-called&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>Performance Issue Caused by Crashed Finalizer Thread</title><link>http://blogs.msdn.com/maoni/archive/2004/11/04/252697.aspx#9532850</link><pubDate>Mon, 06 Apr 2009 05:19:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9532850</guid><dc:creator>AsiaTech: Learning by Practice</dc:creator><description>&lt;p&gt;Customer had a newly developed .NET web application hosted in IIS 6. They recently experienced some performance&lt;/p&gt;
</description></item><item><title>Finalization is only for releasing managed resources?</title><link>http://blogs.msdn.com/maoni/archive/2004/11/04/252697.aspx#9820942</link><pubDate>Tue, 07 Jul 2009 02:29:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9820942</guid><dc:creator>Adam M.</dc:creator><description>&lt;p&gt;Hi Maoni,&lt;/p&gt;
&lt;p&gt;I had two questions. First, you said several times that finalization is only for releasing unmanaged resources.&lt;/p&gt;
&lt;p&gt;I've been in the habit of making objects finalizable if they hold references to IDisposable objects. Then if they get finalized, they'll call the .Dispose() methods of the objects they reference.&lt;/p&gt;
&lt;p&gt;This isn't directly releasing unmanaged resources, but rather disposing managed resources that I assume release some unmanaged resources somewhere down the line. (For instance, I may have a type Big, which is finalizable and uses a large unmanaged buffer, and Small, which uses an instance of Big. So I would make Small finalizable too to dispose the Big inside of it.)&lt;/p&gt;
&lt;p&gt;After reading your blog, I'm wondering if that's a bad idea. Maybe if they're allocated at similar times, then they would be collected at the same time, and so it's needlessly increasing the number of finalizable objects? On the other hand, Small being finalizable to free up Big is similar to Small being finalizable to free up a FileStream (but still different in one important way -- Big only consumes unmanaged memory but FileStream keeps a file open).&lt;/p&gt;
&lt;p&gt;In short, can you elaborate on exactly which situations benefit from making a class finalizable, and which don't, and can you explain in more detail how finalizable objects impact GC performance? (I.e., what extra operations does it need to do if you create one more finalizable object?)&lt;/p&gt;
&lt;p&gt;The second question is about how the GC handles circular references. I remember reading that it can handle them, and I generally haven't worried about them, but sometimes I've made an object disposable (maybe not finalizable) to break circular dependencies when it's related to event handlers. For instance A has a reference to B (a Timer, say) and A also uses an event handler on B (Timer.Tick), creating a reference from B -&amp;gt; Delegate -&amp;gt; A. How important is this kind of thing?&lt;/p&gt;
&lt;p&gt;Thank you, and keep up the good work! :-)&lt;/p&gt;
&lt;p&gt;-- Adam&lt;/p&gt;
</description></item></channel></rss>