<?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: Improving malloc() locality</title>
	<atom:link href="http://blog.mozilla.com/jorendorff/2007/10/30/improving-malloc-locality/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mozilla.com/jorendorff/2007/10/30/improving-malloc-locality/</link>
	<description>where we're building a better SpiderMonkey from parts</description>
	<lastBuildDate>Tue, 30 Jun 2009 14:40:54 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Manic Rogers</title>
		<link>http://blog.mozilla.com/jorendorff/2007/10/30/improving-malloc-locality/comment-page-1/#comment-2581</link>
		<dc:creator>Manic Rogers</dc:creator>
		<pubDate>Thu, 22 Nov 2007 05:57:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/jorendorff/2007/10/30/improving-malloc-locality/#comment-2581</guid>
		<description>Yeah, glibc allocates from thread-local pools, with some form of periodic rebalancing. It was the most scalable malloc available a few years ago, but it&#039;s been beaten since.

The problem of how to make a scalable malloc is fairly well-understand at this point; the problem of fragmentation is essentially unsolvable.  If the lifetime of objects is known statically, then the problem can solved by providing extra information to the allocator, either manually, or through hints from the compiler. So far such hints have not been forthcoming.</description>
		<content:encoded><![CDATA[<p>Yeah, glibc allocates from thread-local pools, with some form of periodic rebalancing. It was the most scalable malloc available a few years ago, but it&#8217;s been beaten since.</p>
<p>The problem of how to make a scalable malloc is fairly well-understand at this point; the problem of fragmentation is essentially unsolvable.  If the lifetime of objects is known statically, then the problem can solved by providing extra information to the allocator, either manually, or through hints from the compiler. So far such hints have not been forthcoming.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jorendorff</title>
		<link>http://blog.mozilla.com/jorendorff/2007/10/30/improving-malloc-locality/comment-page-1/#comment-1851</link>
		<dc:creator>jorendorff</dc:creator>
		<pubDate>Wed, 31 Oct 2007 23:22:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/jorendorff/2007/10/30/improving-malloc-locality/#comment-1851</guid>
		<description>I guess I need to look at TcMalloc source; that page doesn&#039;t mention locality or fragmentation.

Jeff, thread safety is important, but independent of this.  Locking costs can be spread out over many calls to malloc() so that they end up being smallish.  TcMalloc certainly does this; I don&#039;t know about glibc or MS CRT.

(Hard to imagine why glibc wouldn&#039;t--maybe the fixed cost is considered too high?)

Locality can be a big deal.  On average, a page fault is many times worse than passing through a mutex.  Unless there&#039;s contention, a single cache miss is probably comparable to a mutex.  Worst-case locality means your system thrashes.

(It&#039;s possible that TcMalloc&#039;s microbenchmark generates a lot more contention, and fewer memory accesses, than real-life usage would.  I have not looked at it.)</description>
		<content:encoded><![CDATA[<p>I guess I need to look at TcMalloc source; that page doesn&#8217;t mention locality or fragmentation.</p>
<p>Jeff, thread safety is important, but independent of this.  Locking costs can be spread out over many calls to malloc() so that they end up being smallish.  TcMalloc certainly does this; I don&#8217;t know about glibc or MS CRT.</p>
<p>(Hard to imagine why glibc wouldn&#8217;t&#8211;maybe the fixed cost is considered too high?)</p>
<p>Locality can be a big deal.  On average, a page fault is many times worse than passing through a mutex.  Unless there&#8217;s contention, a single cache miss is probably comparable to a mutex.  Worst-case locality means your system thrashes.</p>
<p>(It&#8217;s possible that TcMalloc&#8217;s microbenchmark generates a lot more contention, and fewer memory accesses, than real-life usage would.  I have not looked at it.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Walden</title>
		<link>http://blog.mozilla.com/jorendorff/2007/10/30/improving-malloc-locality/comment-page-1/#comment-1842</link>
		<dc:creator>Jeff Walden</dc:creator>
		<pubDate>Wed, 31 Oct 2007 18:37:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/jorendorff/2007/10/30/improving-malloc-locality/#comment-1842</guid>
		<description>Isn&#039;t the bigger problem (at least in terms of speed) for malloc implementations usually that they have to be threadsafe?</description>
		<content:encoded><![CDATA[<p>Isn&#8217;t the bigger problem (at least in terms of speed) for malloc implementations usually that they have to be threadsafe?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jhermans</title>
		<link>http://blog.mozilla.com/jorendorff/2007/10/30/improving-malloc-locality/comment-page-1/#comment-1791</link>
		<dc:creator>jhermans</dc:creator>
		<pubDate>Tue, 30 Oct 2007 20:27:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/jorendorff/2007/10/30/improving-malloc-locality/#comment-1791</guid>
		<description>I would suggest you take a look at Google&#039;s TcMalloc at http://goog-perftools.sourceforge.net/doc/tcmalloc.html . It uses several techniques to enhance locality of memory blocks.</description>
		<content:encoded><![CDATA[<p>I would suggest you take a look at Google&#8217;s TcMalloc at <a href="http://goog-perftools.sourceforge.net/doc/tcmalloc.html" rel="nofollow">http://goog-perftools.sourceforge.net/doc/tcmalloc.html</a> . It uses several techniques to enhance locality of memory blocks.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
