<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Practical Efficient Memory Management</title>
	<atom:link href="http://entland.homelinux.com/blog/2008/08/19/practical-efficient-memory-management/feed/" rel="self" type="application/rss+xml" />
	<link>http://entland.homelinux.com/blog/2008/08/19/practical-efficient-memory-management/</link>
	<description>Code, 3D, Games, Linux and much more...</description>
	<lastBuildDate>Mon, 09 Nov 2009 03:12:38 +0100</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: ent</title>
		<link>http://entland.homelinux.com/blog/2008/08/19/practical-efficient-memory-management/comment-page-1/#comment-166020</link>
		<dc:creator>ent</dc:creator>
		<pubDate>Tue, 23 Sep 2008 18:01:44 +0000</pubDate>
		<guid isPermaLink="false">http://entland.homelinux.com/blog/?p=112#comment-166020</guid>
		<description>Hi virtul,

The problem with the Low-Fragmentation Heap is that the granularity can be excessive for very small blocks. For example, for a 10 bytes structure, 16 bytes are reserved from the system (an increase of 60%!). This was enough for me to refuse using them but I would like to see stats about them.

Have you tried them?</description>
		<content:encoded><![CDATA[<p>Hi virtul,</p>
<p>The problem with the Low-Fragmentation Heap is that the granularity can be excessive for very small blocks. For example, for a 10 bytes structure, 16 bytes are reserved from the system (an increase of 60%!). This was enough for me to refuse using them but I would like to see stats about them.</p>
<p>Have you tried them?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: virtul</title>
		<link>http://entland.homelinux.com/blog/2008/08/19/practical-efficient-memory-management/comment-page-1/#comment-165975</link>
		<dc:creator>virtul</dc:creator>
		<pubDate>Sun, 21 Sep 2008 08:08:37 +0000</pubDate>
		<guid isPermaLink="false">http://entland.homelinux.com/blog/?p=112#comment-165975</guid>
		<description>Thanks for great article.

&gt;Although the implementation provided by Visual Studio have been &gt;improved a lot (last version tested: Visual Studio 2005) it is not &gt;especially good at the points described before.

What do you think about Low Fragmentation Heap mechanism?</description>
		<content:encoded><![CDATA[<p>Thanks for great article.</p>
<p>&gt;Although the implementation provided by Visual Studio have been &gt;improved a lot (last version tested: Visual Studio 2005) it is not &gt;especially good at the points described before.</p>
<p>What do you think about Low Fragmentation Heap mechanism?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: elvis</title>
		<link>http://entland.homelinux.com/blog/2008/08/19/practical-efficient-memory-management/comment-page-1/#comment-165937</link>
		<dc:creator>elvis</dc:creator>
		<pubDate>Fri, 19 Sep 2008 20:55:52 +0000</pubDate>
		<guid isPermaLink="false">http://entland.homelinux.com/blog/?p=112#comment-165937</guid>
		<description>cool stuff!</description>
		<content:encoded><![CDATA[<p>cool stuff!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jelle  van der Beek</title>
		<link>http://entland.homelinux.com/blog/2008/08/19/practical-efficient-memory-management/comment-page-1/#comment-165824</link>
		<dc:creator>Jelle  van der Beek</dc:creator>
		<pubDate>Tue, 16 Sep 2008 10:39:32 +0000</pubDate>
		<guid isPermaLink="false">http://entland.homelinux.com/blog/?p=112#comment-165824</guid>
		<description>Thanks for your answer!

Ok, continuing down this path, what is a dynamic memory allocation? I know you probably mean: passing an allocation request to the OS. Because, whatever way you put it, dynamic memory allocations are being performed whether you use pools or whether you use the default malloc implementation. There aren&#039;t many differences except for the fact that an allocation at the OS level may be slower in some implementations. The Windows allocator also has specific pool-like structures to optimize for allocations of certain sizes smaller than a certain treshold. Conceptually, there isn&#039;t a much of a difference. Even more, many OS allocators will likely be more efficient than a common implementation. I have also seen some that operate really bad under some circumstances. So, what does &quot;not doing dynamic memory allocations&quot; precisely mean?

I wonder whether you are not looking at this problem from the wrong angle. Personally I believe that many people do. It sometimes seems that pools are generally looked at to be a very good solution to avoiding fragmentation, but the paper I mentioned proves that global solutions are superior to local solutions. So I wonder how you will look at this problem after reading this paper (reading the first 30/40 pages should do).</description>
		<content:encoded><![CDATA[<p>Thanks for your answer!</p>
<p>Ok, continuing down this path, what is a dynamic memory allocation? I know you probably mean: passing an allocation request to the OS. Because, whatever way you put it, dynamic memory allocations are being performed whether you use pools or whether you use the default malloc implementation. There aren&#8217;t many differences except for the fact that an allocation at the OS level may be slower in some implementations. The Windows allocator also has specific pool-like structures to optimize for allocations of certain sizes smaller than a certain treshold. Conceptually, there isn&#8217;t a much of a difference. Even more, many OS allocators will likely be more efficient than a common implementation. I have also seen some that operate really bad under some circumstances. So, what does &#8220;not doing dynamic memory allocations&#8221; precisely mean?</p>
<p>I wonder whether you are not looking at this problem from the wrong angle. Personally I believe that many people do. It sometimes seems that pools are generally looked at to be a very good solution to avoiding fragmentation, but the paper I mentioned proves that global solutions are superior to local solutions. So I wonder how you will look at this problem after reading this paper (reading the first 30/40 pages should do).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ent</title>
		<link>http://entland.homelinux.com/blog/2008/08/19/practical-efficient-memory-management/comment-page-1/#comment-165821</link>
		<dc:creator>ent</dc:creator>
		<pubDate>Tue, 16 Sep 2008 09:33:58 +0000</pubDate>
		<guid isPermaLink="false">http://entland.homelinux.com/blog/?p=112#comment-165821</guid>
		<description>Hi,

Yes, the phrase &#039;the best memory management is doing no memory management at all&#039; is not very correct. I agree with you. My idea was to express that the best very memory management is doing no dynamic allocation at all. Obviously that is hard to achieve without a good memory management architecture. I will fix it in the next version of the article.

About the pools. Most implementations of pools allows some kind of granularity control. For example, your pool of particles can be a linked list of memory chunks. Imagine, you choose the granularity at 32. In that case your number of allocated particles will always be a multiple of 32. But a map with 200 particles will allocate 7 chunks for the pool and the map with 2000 particles will allocate 63 chunks.

Thanks for commenting and thanks for that paper recommendation.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Yes, the phrase &#8216;the best memory management is doing no memory management at all&#8217; is not very correct. I agree with you. My idea was to express that the best very memory management is doing no dynamic allocation at all. Obviously that is hard to achieve without a good memory management architecture. I will fix it in the next version of the article.</p>
<p>About the pools. Most implementations of pools allows some kind of granularity control. For example, your pool of particles can be a linked list of memory chunks. Imagine, you choose the granularity at 32. In that case your number of allocated particles will always be a multiple of 32. But a map with 200 particles will allocate 7 chunks for the pool and the map with 2000 particles will allocate 63 chunks.</p>
<p>Thanks for commenting and thanks for that paper recommendation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jelle  van der Beek</title>
		<link>http://entland.homelinux.com/blog/2008/08/19/practical-efficient-memory-management/comment-page-1/#comment-165713</link>
		<dc:creator>Jelle  van der Beek</dc:creator>
		<pubDate>Fri, 12 Sep 2008 14:58:43 +0000</pubDate>
		<guid isPermaLink="false">http://entland.homelinux.com/blog/?p=112#comment-165713</guid>
		<description>Hi,

I am not sure if I agree on all parts of your article. You say: &#039;the best memory management is doing no memory management at all&#039;. This is derived from the performance optimization rule, but it doesn&#039;t necessary need to work for memory management. I am not sure what &quot;doing no memory management al all&quot; means. In memory management it is harder to create allocators that are space efficient than time-efficient (creating an O(1) allocator is peanuts). Doing no memory management at all can often translate to (what you are also saying later in the article): avoid dynamic memory allocations. If you are trying to do so, this means that you will need to allocate up front or in pools. In many ways this is not space efficient at all. Pools are often thought of as good solutions to avoid fragmentation, but in fact the internal fragmentation is much worse than the external fragmentation. You say that internal fragmentation is insignificant at full loads. Sure, but the problem is generally that the pools are often not full. They need to be large enough for worse-cased scenarios. Using pools you design your application for worse case scenario loads. They cannot be load-balanced. To give an example: you have a memory pool that holds your particles. In some levels you have many particles and in some you have only a few. The pool size needs to be big enough to hold the particles in the worst-case level. Some levels that contain only a few particles may have very large textures, but due to the memory pool structure you cannot load-balance. In most of the levels you have wasted a large part of your memory. A decent general purpose allocator like the ones you suggested would have been much more efficient. You might say that you would setting a pools size per level would solve this problem, but in fact you are only moving it to a smaller scope. And, this process is very cumbersome and error-prone. To conclude, this example shows that &quot;doing no memory management at all&quot; is not entirely true. Doing memory management, but properly, would have been better.

PROs: high performance. And if you get your title running it will keep on running. That is important on game consoles. CON: you are almost certain to be wasting a lot of memory. 

I would recommend to everybody to read the paper: &quot;Dynamic storage allocation, a survey and critical review&quot;. It is an essential read prior to doing anything with memory management. Google it ;)</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I am not sure if I agree on all parts of your article. You say: &#8216;the best memory management is doing no memory management at all&#8217;. This is derived from the performance optimization rule, but it doesn&#8217;t necessary need to work for memory management. I am not sure what &#8220;doing no memory management al all&#8221; means. In memory management it is harder to create allocators that are space efficient than time-efficient (creating an O(1) allocator is peanuts). Doing no memory management at all can often translate to (what you are also saying later in the article): avoid dynamic memory allocations. If you are trying to do so, this means that you will need to allocate up front or in pools. In many ways this is not space efficient at all. Pools are often thought of as good solutions to avoid fragmentation, but in fact the internal fragmentation is much worse than the external fragmentation. You say that internal fragmentation is insignificant at full loads. Sure, but the problem is generally that the pools are often not full. They need to be large enough for worse-cased scenarios. Using pools you design your application for worse case scenario loads. They cannot be load-balanced. To give an example: you have a memory pool that holds your particles. In some levels you have many particles and in some you have only a few. The pool size needs to be big enough to hold the particles in the worst-case level. Some levels that contain only a few particles may have very large textures, but due to the memory pool structure you cannot load-balance. In most of the levels you have wasted a large part of your memory. A decent general purpose allocator like the ones you suggested would have been much more efficient. You might say that you would setting a pools size per level would solve this problem, but in fact you are only moving it to a smaller scope. And, this process is very cumbersome and error-prone. To conclude, this example shows that &#8220;doing no memory management at all&#8221; is not entirely true. Doing memory management, but properly, would have been better.</p>
<p>PROs: high performance. And if you get your title running it will keep on running. That is important on game consoles. CON: you are almost certain to be wasting a lot of memory. </p>
<p>I would recommend to everybody to read the paper: &#8220;Dynamic storage allocation, a survey and critical review&#8221;. It is an essential read prior to doing anything with memory management. Google it <img src='http://entland.homelinux.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: realtimecollisiondetection.net - the blog &#187; Posts and links you should have read</title>
		<link>http://entland.homelinux.com/blog/2008/08/19/practical-efficient-memory-management/comment-page-1/#comment-165354</link>
		<dc:creator>realtimecollisiondetection.net - the blog &#187; Posts and links you should have read</dc:creator>
		<pubDate>Tue, 02 Sep 2008 15:34:16 +0000</pubDate>
		<guid isPermaLink="false">http://entland.homelinux.com/blog/?p=112#comment-165354</guid>
		<description>[...] Christian Gyrling&#8217;s Are we out of memory? and Jesus de Santos Garcia&#8217;s post about Practical Efficient Memory Management (though the latter is clearly a bit too PC-centric, so pinch of salt for consoles). Also read [...]</description>
		<content:encoded><![CDATA[<p>[...] Christian Gyrling&#8217;s Are we out of memory? and Jesus de Santos Garcia&#8217;s post about Practical Efficient Memory Management (though the latter is clearly a bit too PC-centric, so pinch of salt for consoles). Also read [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ent</title>
		<link>http://entland.homelinux.com/blog/2008/08/19/practical-efficient-memory-management/comment-page-1/#comment-165059</link>
		<dc:creator>ent</dc:creator>
		<pubDate>Mon, 25 Aug 2008 19:06:02 +0000</pubDate>
		<guid isPermaLink="false">http://entland.homelinux.com/blog/?p=112#comment-165059</guid>
		<description>True, I will disable it (/Oy-) in Debug/Release and leave it activated in the Final configuration. Thanks for the idea.</description>
		<content:encoded><![CDATA[<p>True, I will disable it (/Oy-) in Debug/Release and leave it activated in the Final configuration. Thanks for the idea.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: yarpen</title>
		<link>http://entland.homelinux.com/blog/2008/08/19/practical-efficient-memory-management/comment-page-1/#comment-165043</link>
		<dc:creator>yarpen</dc:creator>
		<pubDate>Mon, 25 Aug 2008 08:38:09 +0000</pubDate>
		<guid isPermaLink="false">http://entland.homelinux.com/blog/?p=112#comment-165043</guid>
		<description>I considered it, but it turned out it&#039;s easier just not to use FPO (performance gains werent noticeable in our case, so it just wasnt worth it).</description>
		<content:encoded><![CDATA[<p>I considered it, but it turned out it&#8217;s easier just not to use FPO (performance gains werent noticeable in our case, so it just wasnt worth it).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ent</title>
		<link>http://entland.homelinux.com/blog/2008/08/19/practical-efficient-memory-management/comment-page-1/#comment-165030</link>
		<dc:creator>ent</dc:creator>
		<pubDate>Mon, 25 Aug 2008 01:57:14 +0000</pubDate>
		<guid isPermaLink="false">http://entland.homelinux.com/blog/?p=112#comment-165030</guid>
		<description>Hi yarpen,

Interesting article and interesting blog :)

I have a question for you about the StackWalk64... Yes, it is slow but not using it generates incorrect stack traces in release (due to the FPO). Do you switch dinamically to StackWalk64 when RtlCaptureStackBackTrace  fails?</description>
		<content:encoded><![CDATA[<p>Hi yarpen,</p>
<p>Interesting article and interesting blog <img src='http://entland.homelinux.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I have a question for you about the StackWalk64&#8230; Yes, it is slow but not using it generates incorrect stack traces in release (due to the FPO). Do you switch dinamically to StackWalk64 when RtlCaptureStackBackTrace  fails?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
