<?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>Twin paths to garbage collector nirvana</title><link>http://blogs.msdn.com/shawnhar/archive/2007/07/02/twin-paths-to-garbage-collector-nirvana.aspx</link><description>In my previous post I described how to tell if your Xbox garbage collection is taking too long. We saw how the total amount of time spent on garbage collection is the product of the number of collections with the collection latency. This suggests two</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>XBOX Garbage Collector &amp;laquo; Vagrant Muse</title><link>http://blogs.msdn.com/shawnhar/archive/2007/07/02/twin-paths-to-garbage-collector-nirvana.aspx#3667983</link><pubDate>Tue, 03 Jul 2007 09:58:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3667983</guid><dc:creator>XBOX Garbage Collector « Vagrant Muse</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://maheshcr.wordpress.com/2007/07/03/xbox-garbage-collector/"&gt;http://maheshcr.wordpress.com/2007/07/03/xbox-garbage-collector/&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>re: Twin paths to garbage collector nirvana</title><link>http://blogs.msdn.com/shawnhar/archive/2007/07/02/twin-paths-to-garbage-collector-nirvana.aspx#3683619</link><pubDate>Wed, 04 Jul 2007 12:21:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3683619</guid><dc:creator>andyl</dc:creator><description>&lt;p&gt;&amp;quot;It can be tricky to use delegates (especially delegates which form lexical closures) without causing the compiler to allocate memory&amp;quot;&lt;/p&gt;
&lt;p&gt;Shawn, that needs some more explanation and a few examples. So long as I don't allocate the event parameters when the event is raised (i.e. they are pooled somewhere ready for use), I can't seem to make the event model generate garbage! What am I missing here?&lt;/p&gt;
</description></item><item><title>re: Twin paths to garbage collector nirvana</title><link>http://blogs.msdn.com/shawnhar/archive/2007/07/02/twin-paths-to-garbage-collector-nirvana.aspx#3688681</link><pubDate>Wed, 04 Jul 2007 16:01:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3688681</guid><dc:creator>thomas.aylesworth</dc:creator><description>&lt;p&gt;Thanks for the excellent summary of GC issues. &amp;nbsp;For anyone who is looking at my Generic Pool collection class, you should be aware that the current version on my blog does generate some garbage in its iterators. &amp;nbsp;Not enough to cause problems in most cases -- I use it in Snowball Fight without problems; and I've verified that it doesn't change the allocation footprint of the Creator's Club Particle Sample when it's used in there. &amp;nbsp;But it's still something to be aware of.&lt;/p&gt;
&lt;p&gt;I have a new version that uses structs for its iterator, similar to the List class. &amp;nbsp;Although that does generate much less garbage, a quick test showed some boxing that I haven't had time to track down. &amp;nbsp;I'll post it once I can explain the unexpected boxing.&lt;/p&gt;
&lt;p&gt;I also would like to understand more about the conditions under which events and delegates cause allocations. &amp;nbsp;I find the event system to be a powerful part of the language and would like to know when I can and can't rely on it without having to worry about possible gc issues.&lt;/p&gt;
</description></item><item><title>re: Twin paths to garbage collector nirvana</title><link>http://blogs.msdn.com/shawnhar/archive/2007/07/02/twin-paths-to-garbage-collector-nirvana.aspx#3690178</link><pubDate>Wed, 04 Jul 2007 17:36:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3690178</guid><dc:creator>cubed2d</dc:creator><description>&lt;p&gt;Hello, ive got a quick question!&lt;/p&gt;
&lt;p&gt;you suggest using an identifier to cut down on the ammount of object referances, but allso stay to keep away from dictionarys.&lt;/p&gt;
&lt;p&gt;I would of thought dictionarys would be the best way to link referances to id numbers.&lt;/p&gt;
</description></item><item><title>re: Twin paths to garbage collector nirvana</title><link>http://blogs.msdn.com/shawnhar/archive/2007/07/02/twin-paths-to-garbage-collector-nirvana.aspx#3691321</link><pubDate>Wed, 04 Jul 2007 19:02:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3691321</guid><dc:creator>andyl</dc:creator><description>&lt;p&gt;Another thought - what happens if you take the 'I won't produce any garbage' path, and then you integrate some lovely 3rd party game component (lets say collision detection) that assumes the other path ('I'll produce garbage but my object structure is simple'). All hell is going to break loose with the GC, isn't it?!&lt;/p&gt;
&lt;p&gt;For me, it seems a lot of time is going into garbage collection avoidance when coding, when all that is is really needed is a generational GC. Are you guys at least looking into the possibility of a generational GC? Right now, given all of the things I have to be careful of on the 360 CLR, and the lack of comprehensive libraries for things like 3d collision detection, 6 months of coding tells me that writing a complex XNA game for the 360 is no faster or simpler than C++/DirectX would be!&lt;/p&gt;
</description></item><item><title>re: Twin paths to garbage collector nirvana</title><link>http://blogs.msdn.com/shawnhar/archive/2007/07/02/twin-paths-to-garbage-collector-nirvana.aspx#3708099</link><pubDate>Thu, 05 Jul 2007 19:32:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3708099</guid><dc:creator>ShawnHargreaves</dc:creator><description>&lt;p&gt;&amp;gt; you suggest using an identifier to cut down on &lt;/p&gt;
&lt;p&gt;&amp;gt; the ammount of object referances, but allso stay &lt;/p&gt;
&lt;p&gt;&amp;gt; to keep away from dictionarys.&lt;/p&gt;
&lt;p&gt;&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;gt; I would of thought dictionarys would be the best &lt;/p&gt;
&lt;p&gt;&amp;gt; way to link referances to id numbers.&lt;/p&gt;
&lt;p&gt;I don't think that would really help, because you'd still have the reference in the dictionary. Maybe if you had many hundreds of objects all referencing the same thing, and could change that so they all just stored an id and then the dictionary had only one mapping of that id to the actual reference, that could possibly simplify things, but in general you'd probably lose as much by adding the dictionary as you'd gain from removing the references.&lt;/p&gt;
&lt;p&gt;I was suggesting using actual array indices rather than just id codes. If you have an array of players, an array of enemies, an array of bullets, etc, you can reference specific objects just by storing an index into one of these arrays.&lt;/p&gt;
</description></item><item><title>Delegates, events, and garbage</title><link>http://blogs.msdn.com/shawnhar/archive/2007/07/02/twin-paths-to-garbage-collector-nirvana.aspx#3783070</link><pubDate>Mon, 09 Jul 2007 19:07:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3783070</guid><dc:creator>Shawn Hargreaves Blog</dc:creator><description>&lt;p&gt;Some commenters on my previous post asked for more information about the situations where delegates allocate&lt;/p&gt;
</description></item><item><title>Delegates, events, and garbage</title><link>http://blogs.msdn.com/shawnhar/archive/2007/07/02/twin-paths-to-garbage-collector-nirvana.aspx#3783085</link><pubDate>Mon, 09 Jul 2007 19:10:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3783085</guid><dc:creator>Noticias externas</dc:creator><description>&lt;p&gt;Some commenters on my previous post asked for more information about the situations where delegates allocate&lt;/p&gt;
</description></item><item><title>Enums as dictionary keys</title><link>http://blogs.msdn.com/shawnhar/archive/2007/07/02/twin-paths-to-garbage-collector-nirvana.aspx#4382894</link><pubDate>Tue, 14 Aug 2007 14:44:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4382894</guid><dc:creator>CodeMage</dc:creator><description>&lt;p&gt;You can use enums as dictionary keys without causing boxing, just implement an IEqualityComparer for your enum type. See my post:&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://beardseye.blogspot.com/2007/08/nuts-enum-conundrum.html"&gt;http://beardseye.blogspot.com/2007/08/nuts-enum-conundrum.html&lt;/a&gt;&lt;/p&gt;</description></item></channel></rss>