<?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>Taming the CLR: How to Write Real-Time Managed Code</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx</link><description>I've actually been meaning to write about real time applications for ages so when I was asked to give a talk at MS Gamefest ( http://microsoftgamefest.com ) I jumped at the opportunity to give myself a hard reason to do the homework. Last Tuesday I gave</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Taming the CLR: How to Write Real-Time Managed Code</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#713495</link><pubDate>Wed, 23 Aug 2006 05:16:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:713495</guid><dc:creator>Joel Martinez</dc:creator><description>Awesome article! thanks for posting it :-)&lt;br&gt;&lt;br&gt;At some point, I'd love to hear &amp;nbsp;some further thoughts on when to use pointers (reference types?), and how you might improve something by using Handles.</description></item><item><title>CrazyPromoter.com  &amp;raquo; Blog Archive   &amp;raquo; Taming the CLR: How to Write Real-Time Managed Code</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#713548</link><pubDate>Wed, 23 Aug 2006 06:26:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:713548</guid><dc:creator>CrazyPromoter.com  » Blog Archive   » Taming the CLR: How to Write Real-Time Managed Code</dc:creator><description>PingBack from &lt;a rel="nofollow" target="_new" href="http://crazypromoter.com/?p=565"&gt;http://crazypromoter.com/?p=565&lt;/a&gt;</description></item><item><title>re: Taming the CLR: How to Write Real-Time Managed Code</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#713766</link><pubDate>Wed, 23 Aug 2006 10:26:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:713766</guid><dc:creator>Chris Nahr</dc:creator><description>That was a fascinating article. One question: what about the effects of automatic GCs on frame rate and responsiveness on the 360? Would you recommend calling the GC manually in this environment, to ensure that the display won't stutter and user input won't be delayed? Or does the 360 version of the .NET Framework automatically avoid these issues somehow?</description></item><item><title>re: Taming the CLR: How to Write Real-Time Managed Code</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#713798</link><pubDate>Wed, 23 Aug 2006 10:45:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:713798</guid><dc:creator>Chris Nahr</dc:creator><description>Whoops, another question. The Compact Framework with the GC characteristics you describe is the one being used on the Xbox 360, right? I'm assuming this is the case but your article doesn't actually mention it.</description></item><item><title>re: Taming the CLR: How to Write Real-Time Managed Code</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#713834</link><pubDate>Wed, 23 Aug 2006 11:15:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:713834</guid><dc:creator>Ben Hollis</dc:creator><description>Could you toss out a link or two on handles vs pointers? I'm not sure exactly what you mean in the .NET world. I kinda always thought everything was &amp;quot;references&amp;quot; which were basically pointers.</description></item><item><title>re: Taming the CLR: How to Write Real-Time Managed Code</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#714154</link><pubDate>Wed, 23 Aug 2006 13:39:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:714154</guid><dc:creator>Matt</dc:creator><description>Ben:&lt;br&gt;Handles is likely being used in here in the generic (small G) sense of the word.&lt;br&gt;&lt;br&gt;I.E. a number, which when passed to the relevant manager gives you back the thing you are interested in.&lt;br&gt;E.g. imagine you know there will only ever be X entities in your world and most of the time they will all exist.&lt;br&gt;You might create a structure like a tree for dpeth ordering.&lt;br&gt;You could either have a pointer based tree or an array based one.&lt;br&gt;Obviously the array based tree is better from a GC point of view (less pointers, more locality potential when traversing).&lt;br&gt;&lt;br&gt;However if you use the array structure but, within your tree nodes you keep a reference to each entity object then you have additional GC cost. The GC must traverse each node to follow all these references.&lt;br&gt;&lt;br&gt;If intsead your tree nodes contain some integer based lookup to your entities then the nodes contain only integral values, thus the entire tree can be throught of by the GC as nothing but a block of used memory.&lt;br&gt;&lt;br&gt;If you have lot's of data structures holding information about the arrangement of entities this gain can apply to all of them.&lt;br&gt;&lt;br&gt;Obviously this has a cost in access time (you must do the lookup by hand which will involve a few additional operations *).&lt;br&gt;But the GC cost is much lower for this block of memory.&lt;br&gt;&lt;br&gt;Balancing this cost is where the skill of the coder comes in.&lt;br&gt;&lt;br&gt;* The handle should be made a well defined struct so as to hide the index mechanism in case you need to change it, but in effect it is likely to be an index into your array of all entities)</description></item><item><title>re: Taming the CLR: How to Write Real-Time Managed Code</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#714815</link><pubDate>Wed, 23 Aug 2006 18:15:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:714815</guid><dc:creator>JoelMartinez</dc:creator><description>Thanks for the clarification Matt ... I wonder if I might be able to get some feedback as to wether this is along the lines of what you're talking about:&lt;br&gt;&lt;a rel="nofollow" target="_new" href="http://pastebin.ca/146362"&gt;http://pastebin.ca/146362&lt;/a&gt;</description></item><item><title>re: Taming the CLR: How to Write Real-Time Managed Code</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#714854</link><pubDate>Wed, 23 Aug 2006 18:40:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:714854</guid><dc:creator>Frank Hileman</dc:creator><description>Joel, I think Rico was referring to integers instead of pointers. If your handle is an object containing an integer (as in the example), that defeats the purpose. Here are a couple examples using integers instead of pointers.&lt;br&gt;&lt;br&gt;		/// &amp;lt;summary&amp;gt;&lt;br&gt;		/// Creates a binary tree from a linked list of pooled free nodes, using array&lt;br&gt;		/// indices as node references. Nodes can be removed, but the method was not written.&lt;br&gt;		/// &amp;lt;/summary&amp;gt;&lt;br&gt;		class Tree5&lt;br&gt;		{&lt;br&gt;			private const int startSize = 16;&lt;br&gt;			private static Node[] pool = CreateNodes();&lt;br&gt;			private static int nextFree = 0;&lt;br&gt;			private static int root = -1;&lt;br&gt;			private static int count;&lt;br&gt;&lt;br&gt;			private static Node[] CreateNodes()&lt;br&gt;			{&lt;br&gt;				Node[] nodes = new Node[startSize];&lt;br&gt;				InitializeNodes(nodes, 0);&lt;br&gt;				return nodes;&lt;br&gt;			}&lt;br&gt;&lt;br&gt;			private static void InitializeNodes(Node[] nodes, int start)&lt;br&gt;			{&lt;br&gt;				// initialize all but last&lt;br&gt;				InitializeNodes(nodes, start, nodes.Length - 1);&lt;br&gt;				nodes[nodes.Length - 1] = new Node(-1, -1, -1); // marks end of pool&lt;br&gt;			}&lt;br&gt;&lt;br&gt;			private static void InitializeNodes(Node[] nodes, int start, int count)&lt;br&gt;			{&lt;br&gt;				// right node is next free; -1 marks empty reference&lt;br&gt;				for (int i = start; i &amp;lt; count; ++i)&lt;br&gt;					nodes[i] = new Node(-1, -1, i + 1);&lt;br&gt;			}&lt;br&gt;&lt;br&gt;			static public void Insert(int key)&lt;br&gt;			{&lt;br&gt;				if (root == -1)&lt;br&gt;				{&lt;br&gt;					root = NewNode(key);&lt;br&gt;					return;&lt;br&gt;				}&lt;br&gt;				int t = root;&lt;br&gt;				for (;;)&lt;br&gt;				{&lt;br&gt;					Node n = pool[t];&lt;br&gt;					if (n.Key == key)&lt;br&gt;						return;&lt;br&gt;&lt;br&gt;					if (key &amp;lt; n.Key)&lt;br&gt;					{&lt;br&gt;						if (n.Left == -1)&lt;br&gt;						{&lt;br&gt;							pool[t].Left = NewNode(key);&lt;br&gt;							return;&lt;br&gt;						}&lt;br&gt;						t = n.Left;&lt;br&gt;					}&lt;br&gt;					else&lt;br&gt;					{&lt;br&gt;						if (n.Right == -1)&lt;br&gt;						{&lt;br&gt;							pool[t].Right = NewNode(key);&lt;br&gt;							return;&lt;br&gt;						}&lt;br&gt;						t = n.Right;&lt;br&gt;					}&lt;br&gt;				}&lt;br&gt;			}&lt;br&gt;&lt;br&gt;			private static int NewNode(int key) &lt;br&gt;			{ &lt;br&gt;				if (nextFree == -1)&lt;br&gt;					IncreaseCapacity();&lt;br&gt;				int t = nextFree;&lt;br&gt;				nextFree = pool[t].Right;&lt;br&gt;				pool[t] = new Node(key, -1, -1);&lt;br&gt;				count++;&lt;br&gt;				return t;&lt;br&gt;			}&lt;br&gt;&lt;br&gt;			private static void IncreaseCapacity()&lt;br&gt;			{&lt;br&gt;				int size = pool.Length;&lt;br&gt;				Node[] nodes = new Node[size * 2];&lt;br&gt;				Array.Copy(pool, nodes, size);&lt;br&gt;				InitializeNodes(nodes, size);&lt;br&gt;				pool = nodes;&lt;br&gt;				nextFree = size;&lt;br&gt;			}&lt;br&gt; &lt;br&gt;			public static void Reset()&lt;br&gt;			{&lt;br&gt;				InitializeNodes(pool, 0, count);&lt;br&gt;				count = 0;&lt;br&gt;				nextFree = 0;&lt;br&gt;				root = -1;&lt;br&gt;			}&lt;br&gt;&lt;br&gt;			private struct Node&lt;br&gt;			{&lt;br&gt;				public int Key;&lt;br&gt;				public int Left;&lt;br&gt;				public int Right;&lt;br&gt;&lt;br&gt;				public Node(int key, int left, int right)&lt;br&gt;				{&lt;br&gt;					Key = key;&lt;br&gt;					Left = left;&lt;br&gt;					Right = right;&lt;br&gt;				}&lt;br&gt;			}&lt;br&gt;		}&lt;br&gt;&lt;br&gt;		/// &amp;lt;summary&amp;gt;&lt;br&gt;		/// Creates a binary tree from an array of pooled free nodes, using array&lt;br&gt;		/// indices as node references. Nodes cannot be removed; the tree can only be reset&lt;br&gt;		/// as a unit. Capacity can be initially set.&lt;br&gt;		/// &amp;lt;/summary&amp;gt;&lt;br&gt;		class Tree6&lt;br&gt;		{&lt;br&gt;			private const int startSize = 16;&lt;br&gt;			private static Node[] pool = new Node[startSize];&lt;br&gt;			private static int count = 0;&lt;br&gt;&lt;br&gt;			// NOTE: in this tree, 0 signals a null node reference&lt;br&gt;			public static void SetCapacity(int capacity)&lt;br&gt;			{&lt;br&gt;				pool = new Node[capacity];&lt;br&gt;				count = 0;&lt;br&gt;			}&lt;br&gt;&lt;br&gt;			static public void Insert(int key)&lt;br&gt;			{&lt;br&gt;				if (count == 0)&lt;br&gt;				{&lt;br&gt;					NewNode(key);&lt;br&gt;					return;&lt;br&gt;				}&lt;br&gt;				int t = 0;				// root node always 0&lt;br&gt;				for (;;)&lt;br&gt;				{&lt;br&gt;					Node n = pool[t];&lt;br&gt;					if (n.Key == key)&lt;br&gt;						return;&lt;br&gt;&lt;br&gt;					if (key &amp;lt; n.Key)&lt;br&gt;					{&lt;br&gt;						if (n.Left == 0)&lt;br&gt;						{&lt;br&gt;							pool[t].Left = NewNode(key);&lt;br&gt;							return;&lt;br&gt;						}&lt;br&gt;						t = n.Left;&lt;br&gt;					}&lt;br&gt;					else&lt;br&gt;					{&lt;br&gt;						if (n.Right == 0)&lt;br&gt;						{&lt;br&gt;							pool[t].Right = NewNode(key);&lt;br&gt;							return;&lt;br&gt;						}&lt;br&gt;						t = n.Right;&lt;br&gt;					}&lt;br&gt;				}&lt;br&gt;			}&lt;br&gt;&lt;br&gt;			private static int NewNode(int key) &lt;br&gt;			{ &lt;br&gt;				if (count == pool.Length)&lt;br&gt;					IncreaseCapacity();&lt;br&gt;				int t = count++;&lt;br&gt;				pool[t] = new Node(key);&lt;br&gt;				return t;&lt;br&gt;			}&lt;br&gt;&lt;br&gt;			private static void IncreaseCapacity()&lt;br&gt;			{&lt;br&gt;				int size = pool.Length;&lt;br&gt;				Node[] nodes = new Node[size * 2];&lt;br&gt;				Array.Copy(pool, nodes, size);&lt;br&gt;				pool = nodes;&lt;br&gt;			}&lt;br&gt; &lt;br&gt;			public static void Reset()&lt;br&gt;			{&lt;br&gt;				count = 0;&lt;br&gt;			}&lt;br&gt;&lt;br&gt;			private struct Node&lt;br&gt;			{&lt;br&gt;				public int Key;&lt;br&gt;				public int Left;&lt;br&gt;				public int Right;&lt;br&gt;&lt;br&gt;				public Node(int key)&lt;br&gt;				{&lt;br&gt;					Key = key;&lt;br&gt;					Left = 0;&lt;br&gt;					Right = 0;&lt;br&gt;				}&lt;br&gt;			}&lt;br&gt;		}</description></item><item><title>re: Taming the CLR: How to Write Real-Time Managed Code</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#714862</link><pubDate>Wed, 23 Aug 2006 18:48:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:714862</guid><dc:creator>JoelMartinez</dc:creator><description>But what of Matt's comment:&lt;br&gt;&lt;br&gt;&amp;quot;The handle should be made a well defined struct so as to hide the index mechanism in case you need to change it, but in effect it is likely to be an index into your array of all entities)&amp;quot;&lt;br&gt;&lt;br&gt;Wouldn't a structure of value types be able to partake in the benefits just as if it was a simple integer (as long as it doesn't have any references of course)?&lt;br&gt;&lt;br&gt;In my example, the handle struct did have a property which returned the referenced Sprite, but it wasn't an actual reference, it simply delegated the call to the SpriteManager.&lt;br&gt;&lt;br&gt;I have to admit I'm having somewhat of a tough time understanding the why, where, and how to apply this ... would love for others to chime in and add to the discussion :-)</description></item><item><title>re: Taming the CLR: How to Write Real-Time Managed Code</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#714921</link><pubDate>Wed, 23 Aug 2006 19:41:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:714921</guid><dc:creator>Frank Hileman</dc:creator><description>You are correct, sorry I did not notice it was a struct and not a class. Matt is correct, if you are to expose the handle to the public it should be wrapped in a struct.&lt;br&gt;&lt;br&gt;I find integer index pointer replacement most useful for internal data structures (such as the posted tree classes) where the end user has the same experience, regardless of the internal choice of a pointer or integer to reference something. &lt;br&gt;&lt;br&gt;For public API's, handles are cumbersome. Nearly always you can find an alternative API that does not need to expose them.</description></item><item><title>re: Taming the CLR: How to Write Real-Time Managed Code</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#714989</link><pubDate>Wed, 23 Aug 2006 20:26:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:714989</guid><dc:creator>JoelMartinez</dc:creator><description>So would you say that the effort to implement something like this is only worth it if said data structures are relatively short lived?&lt;br&gt;&lt;br&gt;I mean, what if you have a List&amp;lt;&amp;gt; of objects that are long lived ... would it be worthwhile to do this. &amp;nbsp;Or does the fact that the list is referenced/traversed somewhat often make the shorter GC time not worth it?&lt;br&gt;&lt;br&gt;I suppose thats what Matt was talking about when he said, &amp;quot;Balancing this cost is where the skill of the coder comes in. &amp;quot; &amp;nbsp;:-)</description></item><item><title>re: Taming the CLR: How to Write Real-Time Managed Code</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#715084</link><pubDate>Wed, 23 Aug 2006 21:36:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:715084</guid><dc:creator>ricom</dc:creator><description>Frank and Joel seem to have the right idea when it comes to what I meant about handles. &amp;nbsp;I wouldn't jump there too quickly though -- in a game context it can be excellent if you have some fairly static structures that you set up for say a game level and then just park for a considerable amount of time. &amp;nbsp;Making those cheap to collect is a good deal. &amp;nbsp;Other contexts might also benefit for similar reasons but if you intend to mutate the data very much you've basically replaced managed pointers with self-managed pointers disguised as integers. &amp;nbsp; Not sure that's really wise.&lt;br&gt;&lt;br&gt;Some hybrid is likely the best choice.&lt;br&gt;&lt;br&gt;Now on the desktop CLR this is much less interesting because you can just let your objects age into gen2 and they won't need to be walked very much anyway.&lt;br&gt;&lt;br&gt;On .NET CF you might be more excited about this because everything has to be traced every collect.&lt;br&gt;&lt;br&gt;Again... do this wisely with data to back you up, not because big-mouth Rico said it might be interesting :)&lt;br&gt;&lt;br&gt;Wrapping the handles in a struct would be ideal but make sure you aren't killing your code-gen by doing so. &amp;nbsp;If you lost some important inlining you might just have to bite the bullet and do it the hard way.&lt;br&gt;&lt;br&gt;If .NET CF is in the picture you're talking about a great deal of portability (awesome) but also several JITs to check out (ouch). &amp;nbsp;Simpler might be better.&lt;br&gt;&lt;br&gt;Lastly, remember I'm not a .NET CF expert, I only proxy for one at game conferences :)</description></item><item><title>re: Taming the CLR: How to Write Real-Time Managed Code</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#715270</link><pubDate>Wed, 23 Aug 2006 23:21:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:715270</guid><dc:creator>Andrew</dc:creator><description>Great summary of how the GC works! I have a few comments though.&lt;br&gt;&lt;br&gt;Rico wrote:&lt;br&gt;&amp;quot;People learned best practices for classic memory allocators ... you have to wrap them. &amp;nbsp;And that’s exactly what everyone does.&amp;quot;&lt;br&gt;&lt;br&gt;If you are wrapping a classic memory manager then it's trivial to keep track of which line of code made a particular allocation, which is usually all you need to fix a leak. A wrapper also allows you to keep statistics which can detect leaks automatically in debug builds.&lt;br&gt;&lt;br&gt;There are also techniques, such as buddy memory allocation, that eliminate external fragmentation without the need for compaction.&lt;br&gt;&lt;br&gt;Rico wrote:&lt;br&gt;&amp;quot;Garbage Collected memory model is the centerpiece. Amortized cost of allocations in this model can be excellent!&amp;quot;&lt;br&gt;&lt;br&gt;What makes realtime software so fun is that it absolutely has to meet it's realtime deadlines 100% of the time. Worst case, not amortized, is the cost of interest.&lt;br&gt;&lt;br&gt;I've been writing realtime software for 10 years now and I'd rather fix 100 memory leaks than a single missed realtime deadline problem caused by a non-deterministic thread like a GC!</description></item><item><title>re: Taming the CLR: How to Write Real-Time Managed Code</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#715461</link><pubDate>Thu, 24 Aug 2006 00:54:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:715461</guid><dc:creator>ricom</dc:creator><description>All good thoughts from Andrew above.&lt;br&gt;&lt;br&gt;Controlling heap size and allocation volume are great ways to control maximum collection costs.&lt;br&gt;&lt;br&gt;A theme of the advice is that collections are induced by allocations, so controlling allocations lets you control frequency and cost of collections while keeping a simpler model.&lt;br&gt;&lt;br&gt;It isn't falling off a log but it can (and does) work with some care.&lt;br&gt;&lt;br&gt;Life is never easy in the real(time) world.</description></item><item><title>Interesting Finds: August 23, 2006</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#716011</link><pubDate>Thu, 24 Aug 2006 05:38:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:716011</guid><dc:creator>Jason Haley</dc:creator><description /></item><item><title>re: Taming the CLR: How to Write Real-Time Managed Code</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#717036</link><pubDate>Thu, 24 Aug 2006 15:58:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:717036</guid><dc:creator>Matt</dc:creator><description>Rico,&lt;br&gt;&lt;br&gt;Another useful article - thanks for the tips.&lt;br&gt;&lt;br&gt;We have a large desktop application under development here that's exhibiting an ever-growing Gen 2 heap (occasional GCs of small portions of the heap are occurring, but the trend is otherwise inexorably skywards). &lt;br&gt;&lt;br&gt;Some people here are arguing that this is not a problem, as the CLR would collect more of the heap if it needed it. The machines running the app are typically very high-spec, with 2GB RAM.&lt;br&gt;&lt;br&gt;What say you?</description></item><item><title>Tame the CLR: Expect game-quality real-time performance from managed code</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#717928</link><pubDate>Thu, 24 Aug 2006 19:26:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:717928</guid><dc:creator>Robert Burke's Weblog</dc:creator><description>Game development is one of those dark arts where the usual laws of scalability don't always apply.&amp;amp;amp;nbsp;...</description></item><item><title>re: Taming the CLR: How to Write Real-Time Managed Code</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#718637</link><pubDate>Thu, 24 Aug 2006 21:19:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:718637</guid><dc:creator>ricom</dc:creator><description>&amp;gt;&amp;gt;We have a large desktop application under development here that's exhibiting an ever-growing Gen 2 heap (occasional GCs of small portions of the heap are occurring, but the trend is otherwise inexorably skywards). &lt;br&gt;&lt;br&gt;The long and the short of it is that the GC will tend to collect when it seems worthwhile to do so. &amp;nbsp;So if your death rate in generation 2 is fairly low the CLR will just let it sit because on a percentage basis the amount of waste seems low. &amp;nbsp;Generally we're pretty good about getting this right.&lt;br&gt;&lt;br&gt;So when are we likely to get this wrong you ask? &amp;nbsp;Look at &lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/ricom/archive/2004/11/29/271829.aspx"&gt;http://blogs.msdn.com/ricom/archive/2004/11/29/271829.aspx&lt;/a&gt; for information on that.&lt;br&gt;&lt;br&gt;Many applications tend to accumulate state. &amp;nbsp;If that's a normal thing for your algorithms, then it's not a problem. &amp;nbsp;If that's not normal then maybe you are holding on to objects you could release (leaks) or maybe you have episodic deaths (see link above).&lt;br&gt;&lt;br&gt;A common source of leaks is where some data structures get linked to durable objects like event sources and are not unlinked when they die. &amp;nbsp;The event source lives forever and therefore so do the things that registered to receive the events.</description></item><item><title>re: Taming the CLR: How to Write Real-Time Managed Code</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#719474</link><pubDate>Fri, 25 Aug 2006 03:13:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:719474</guid><dc:creator>lb</dc:creator><description>you're like one of those crazy people you see on the bus who are muttering crazy things to themselves. But in a really good and positive way ;-)&lt;br&gt;&lt;br&gt;i like it.</description></item><item><title>re: Taming the CLR: How to Write Real-Time Managed Code</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#719558</link><pubDate>Fri, 25 Aug 2006 03:49:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:719558</guid><dc:creator>ricom</dc:creator><description>Err. &amp;nbsp;Thanks. &amp;nbsp;I think :)</description></item><item><title>Tame that CLR!</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#720575</link><pubDate>Fri, 25 Aug 2006 06:40:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:720575</guid><dc:creator>Michael Klucher's XNA Blog</dc:creator><description>It almost seems like it was planned, but at Gamefest Rico Mariani did a talk titled &amp;amp;quot;Taming the CLR:...</description></item><item><title>Rico Tames the CLR</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#721131</link><pubDate>Fri, 25 Aug 2006 10:21:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:721131</guid><dc:creator>Scott Holden's Blog</dc:creator><description>Rico posted an article&amp;amp;amp;nbsp;Taming The CLR: How to Write Real-Time Managed Code&amp;amp;amp;nbsp;with the contents...</description></item><item><title>Rico: Taming the CLR &amp;laquo; Tales from a Trading Desk</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#724412</link><pubDate>Fri, 25 Aug 2006 23:17:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:724412</guid><dc:creator>Rico: Taming the CLR « Tales from a Trading Desk</dc:creator><description>PingBack from &lt;a rel="nofollow" target="_new" href="http://mdavey.wordpress.com/2006/08/25/rico-taming-the-clr/"&gt;http://mdavey.wordpress.com/2006/08/25/rico-taming-the-clr/&lt;/a&gt;</description></item><item><title>Rico's Talk from Gamefest</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#725549</link><pubDate>Sat, 26 Aug 2006 20:51:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:725549</guid><dc:creator>XNA Diaries</dc:creator><description>While the slides and recordings from Gamefest are not yet available on the&amp;amp;amp;nbsp;conference website, Rico...</description></item><item><title>Watch these mid-life objects! real-time managed code</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#726519</link><pubDate>Sun, 27 Aug 2006 12:22:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:726519</guid><dc:creator>Ido Samuelson's blog</dc:creator><description>This article&amp;amp;amp;nbsp;has some great info regarding real-time and manage code.&lt;br&gt;&amp;amp;amp;nbsp;</description></item><item><title /><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#728525</link><pubDate>Mon, 28 Aug 2006 19:08:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:728525</guid><dc:creator>TrackBack</dc:creator><description>PingBack from &lt;a rel="nofollow" target="_new" href="http://blog.3deurope.com/index.php/2006/08/28/managed-code-for-games/"&gt;http://blog.3deurope.com/index.php/2006/08/28/managed-code-for-games/&lt;/a&gt;</description></item><item><title>Community Convergence</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#740262</link><pubDate>Tue, 05 Sep 2006 03:46:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:740262</guid><dc:creator>Charlie Calvert's Community Blog</dc:creator><description>The C# team is happy to welcome you to the new look of the C# Developer Center. This is the home page...</description></item><item><title>Community Convergence</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#740279</link><pubDate>Tue, 05 Sep 2006 04:01:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:740279</guid><dc:creator>Charlie Calvert's Community Blog</dc:creator><description>The C# team is happy to welcome you to the new look of the C# Developer Center. This is the home page...</description></item><item><title>Community Convergence</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#740292</link><pubDate>Tue, 05 Sep 2006 04:06:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:740292</guid><dc:creator>Charlie Calvert's Community Blog</dc:creator><description>The C# team is happy to welcome you to the new look of the C# Developer Center. This is the home page...</description></item><item><title>Community Convergence</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#740305</link><pubDate>Tue, 05 Sep 2006 04:11:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:740305</guid><dc:creator>Charlie Calvert's Community Blog</dc:creator><description>The C# team is happy to welcome you to the new look of the C# Developer Center. This is the home page...</description></item><item><title>Performance Quiz #11: Ten Questiosn on Value-Based Programming : Solution</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#745087</link><pubDate>Fri, 08 Sep 2006 00:52:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:745087</guid><dc:creator>Rico Mariani's Performance Tidbits</dc:creator><description>In my last quiz I asked a few questions about a few hypothetical classes that might appear in a value-right...</description></item><item><title>Games go Managed with XNA &amp;laquo; G Krishnaa</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#1038172</link><pubDate>Wed, 08 Nov 2006 20:51:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1038172</guid><dc:creator>Games go Managed with XNA « G Krishnaa</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://gkrishnaa.wordpress.com/2006/08/24/games-go-managed-with-xna/"&gt;http://gkrishnaa.wordpress.com/2006/08/24/games-go-managed-with-xna/&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>Managed Code Performance on Xbox 360 for XNA: Part 1 - Intro and CPU</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#1349491</link><pubDate>Sat, 23 Dec 2006 00:21:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1349491</guid><dc:creator>.NET Compact Framework Team</dc:creator><description>&lt;p&gt;Introduction Now that XNA Game Studio Express 1.0 is out, it’s time to start writing managed code for&lt;/p&gt;
</description></item><item><title>Performance Quiz #11: Ten Questions on Value-Based Programming : Solution</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#1518786</link><pubDate>Wed, 24 Jan 2007 05:22:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1518786</guid><dc:creator>Rico Mariani's Performance Tidbits</dc:creator><description>&lt;p&gt;In my last quiz I asked a few questions about a few hypothetical classes that might appear in a value-rich&lt;/p&gt;
</description></item><item><title>presentationpointers.check4cheap.com  &amp;raquo; Blog Archive  </title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#5806835</link><pubDate>Thu, 01 Nov 2007 02:40:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5806835</guid><dc:creator>presentationpointers.check4cheap.com  » Blog Archive  </dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://presentationpointers.check4cheap.com/?p=149"&gt;http://presentationpointers.check4cheap.com/?p=149&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>how is the game clr played</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#8668423</link><pubDate>Sun, 29 Jun 2008 23:38:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8668423</guid><dc:creator>how is the game clr played</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://anton.meinvoll.com/howisthegameclrplayed.html"&gt;http://anton.meinvoll.com/howisthegameclrplayed.html&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>A Tale of Two Memory Managers (long) | keyongtech</title><link>http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx#9338453</link><pubDate>Sun, 18 Jan 2009 20:41:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9338453</guid><dc:creator>A Tale of Two Memory Managers (long) | keyongtech</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.keyongtech.com/1332952-a-tale-of-two-memory"&gt;http://www.keyongtech.com/1332952-a-tale-of-two-memory&lt;/a&gt;&lt;/p&gt;
</description></item></channel></rss>