<?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"
	>
<channel>
	<title>Comments on: malloc replacements?</title>
	<atom:link href="http://blog.pavlov.net/2007/11/21/malloc-replacements/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.pavlov.net/2007/11/21/malloc-replacements/</link>
	<description>Ramblings from the mind of Stuart Parmenter</description>
	<pubDate>Thu, 21 Aug 2008 07:18:48 +0000</pubDate>
	<generator>http://wordpress.org/?v=MU</generator>
		<item>
		<title>By: Steve Chapel</title>
		<link>http://blog.pavlov.net/2007/11/21/malloc-replacements/#comment-763</link>
		<dc:creator>Steve Chapel</dc:creator>
		<pubDate>Mon, 26 Nov 2007 15:57:22 +0000</pubDate>
		<guid isPermaLink="false">http://blog.pavlov.net/2007/11/21/malloc-replacements/#comment-763</guid>
		<description>It's not that Firefox never gets above 200 MB. I regularly see it reach 500 MB when I have many tabs open with pages that use different plugins. I usually close most of my tabs on a regular basis, so memory use then drops to under 200 MB. If I run the Browser Mem Buster Test, which always keeps ten tabs open, memory use stays under 200 MB the entire time and drops to about 100 MB after closing all tabs but one. In my experience, fragmentation and memory leaks combined never seem to be taking more than around 100 MB total, even after a week of use.

I suppose I need to ask: How many tabs are we talking about? Dozens? Hundreds? I suppose I also need to ask: On what OS are you seeing this extreme fragmentation, because I never see it with Windows XP. Let's get specific.</description>
		<content:encoded><![CDATA[<p>It&#8217;s not that Firefox never gets above 200 MB. I regularly see it reach 500 MB when I have many tabs open with pages that use different plugins. I usually close most of my tabs on a regular basis, so memory use then drops to under 200 MB. If I run the Browser Mem Buster Test, which always keeps ten tabs open, memory use stays under 200 MB the entire time and drops to about 100 MB after closing all tabs but one. In my experience, fragmentation and memory leaks combined never seem to be taking more than around 100 MB total, even after a week of use.</p>
<p>I suppose I need to ask: How many tabs are we talking about? Dozens? Hundreds? I suppose I also need to ask: On what OS are you seeing this extreme fragmentation, because I never see it with Windows XP. Let&#8217;s get specific.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pavlov</title>
		<link>http://blog.pavlov.net/2007/11/21/malloc-replacements/#comment-753</link>
		<dc:creator>pavlov</dc:creator>
		<pubDate>Mon, 26 Nov 2007 05:55:42 +0000</pubDate>
		<guid isPermaLink="false">http://blog.pavlov.net/2007/11/21/malloc-replacements/#comment-753</guid>
		<description>Steve: I disagree.  Given the growth patterns of our fragmentation the app is going to keep taking up more and more and more memory over time without actually leaking.  If you never get Firefox 2 over 200mb then I suspect you aren't loading very many windows or tabs at once.  I can get Firefox 2 over 200mb _really_ quickly.</description>
		<content:encoded><![CDATA[<p>Steve: I disagree.  Given the growth patterns of our fragmentation the app is going to keep taking up more and more and more memory over time without actually leaking.  If you never get Firefox 2 over 200mb then I suspect you aren&#8217;t loading very many windows or tabs at once.  I can get Firefox 2 over 200mb _really_ quickly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Chapel</title>
		<link>http://blog.pavlov.net/2007/11/21/malloc-replacements/#comment-750</link>
		<dc:creator>Steve Chapel</dc:creator>
		<pubDate>Mon, 26 Nov 2007 03:40:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.pavlov.net/2007/11/21/malloc-replacements/#comment-750</guid>
		<description>mizra says "For example, people are crying that Firefox, open for 2 days and doing nothing, eats 1GB or more RAM. If you change alloc, that number might be, say, 500MB (albeit I don’t think so) … but thats still bad!"

It sounds like those people are suffering from extreme memory leaks. After I've been using Firefox 2 for a week, it uses only 200 MB of RAM. After three days of using Firefox 3 beta 1, it's still using only 126 MB. I can't see how changing the allocator is going to reduce memory usage by hundreds of megabytes. It won't do anything noticeable for people having the most severe problems.</description>
		<content:encoded><![CDATA[<p>mizra says &#8220;For example, people are crying that Firefox, open for 2 days and doing nothing, eats 1GB or more RAM. If you change alloc, that number might be, say, 500MB (albeit I don’t think so) … but thats still bad!&#8221;</p>
<p>It sounds like those people are suffering from extreme memory leaks. After I&#8217;ve been using Firefox 2 for a week, it uses only 200 MB of RAM. After three days of using Firefox 3 beta 1, it&#8217;s still using only 126 MB. I can&#8217;t see how changing the allocator is going to reduce memory usage by hundreds of megabytes. It won&#8217;t do anything noticeable for people having the most severe problems.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yusuf Goolamabbas</title>
		<link>http://blog.pavlov.net/2007/11/21/malloc-replacements/#comment-674</link>
		<dc:creator>Yusuf Goolamabbas</dc:creator>
		<pubDate>Fri, 23 Nov 2007 13:46:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.pavlov.net/2007/11/21/malloc-replacements/#comment-674</guid>
		<description>Stuart, Forgot to mention that Andrew Tridgell of rsync/samba fame has also written talloc

http://talloc.samba.org/
http://arjen-lentz.livejournal.com/60924.html
http://www.algorithm.com.au/blog/files/jan-2006.php
http://ozlabs.org/~rusty/index.cgi/tech/2006-02-17.html</description>
		<content:encoded><![CDATA[<p>Stuart, Forgot to mention that Andrew Tridgell of rsync/samba fame has also written talloc</p>
<p><a href="http://talloc.samba.org/" rel="nofollow">http://talloc.samba.org/</a><br />
<a href="http://arjen-lentz.livejournal.com/60924.html" rel="nofollow">http://arjen-lentz.livejournal.com/60924.html</a><br />
<a href="http://www.algorithm.com.au/blog/files/jan-2006.php" rel="nofollow">http://www.algorithm.com.au/blog/files/jan-2006.php</a><br />
<a href="http://ozlabs.org/~rusty/index.cgi/tech/2006-02-17.html" rel="nofollow">http://ozlabs.org/~rusty/index.cgi/tech/2006-02-17.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mirza</title>
		<link>http://blog.pavlov.net/2007/11/21/malloc-replacements/#comment-672</link>
		<dc:creator>mirza</dc:creator>
		<pubDate>Fri, 23 Nov 2007 13:26:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.pavlov.net/2007/11/21/malloc-replacements/#comment-672</guid>
		<description>hm, html distroyed my example, I will change braces:

 "std::vector{MyClass} is one big heap alloc, no fragmentation. std::vector{MyClass*} is many little allocs (fragmentation alert!)."</description>
		<content:encoded><![CDATA[<p>hm, html distroyed my example, I will change braces:</p>
<p> &#8220;std::vector{MyClass} is one big heap alloc, no fragmentation. std::vector{MyClass*} is many little allocs (fragmentation alert!).&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mirza</title>
		<link>http://blog.pavlov.net/2007/11/21/malloc-replacements/#comment-671</link>
		<dc:creator>mirza</dc:creator>
		<pubDate>Fri, 23 Nov 2007 13:22:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.pavlov.net/2007/11/21/malloc-replacements/#comment-671</guid>
		<description>Each alloc algorithm is trying to get best deal between low fragmentation and speed. Native c++ lib on each platform choose one that should be best for general usage. I think that solution to fragmented memory should be in elimination of allocations of *single* objects on heap. For example: std::vector is one big heap alloc, no fragmentation. std::vector is many little allocs (fragmentation alert!). If MyClass contains string attribute(s), fragmentation alert again! In such case MyClass should contain only (int) handle to string and strings should be stored together in string container (one implementation of which I sent to mike2leonard@netscape.com, but there are several available on internet). String container is, again, only two allocs (if done right), no mather how many strings, and therefore no fragmentation. 

So, what I am trying to say that if C++ is used in fragmentation-aware way, you don't need to change default alloc algorithm. If you allocate lots of individual objects on heap, changing alloc will not help you *much*. For example, people are crying that Firefox, open for 2 days and doing nothing, eats 1GB or more RAM. If you change alloc, that number might be, say, 500MB (albeit I don't think so) ... but thats still bad! Not to mention that less-fragmenting alloc will be slower by definition.</description>
		<content:encoded><![CDATA[<p>Each alloc algorithm is trying to get best deal between low fragmentation and speed. Native c++ lib on each platform choose one that should be best for general usage. I think that solution to fragmented memory should be in elimination of allocations of *single* objects on heap. For example: std::vector is one big heap alloc, no fragmentation. std::vector is many little allocs (fragmentation alert!). If MyClass contains string attribute(s), fragmentation alert again! In such case MyClass should contain only (int) handle to string and strings should be stored together in string container (one implementation of which I sent to <a href="mailto:mike2leonard@netscape.com">mike2leonard@netscape.com</a>, but there are several available on internet). String container is, again, only two allocs (if done right), no mather how many strings, and therefore no fragmentation. </p>
<p>So, what I am trying to say that if C++ is used in fragmentation-aware way, you don&#8217;t need to change default alloc algorithm. If you allocate lots of individual objects on heap, changing alloc will not help you *much*. For example, people are crying that Firefox, open for 2 days and doing nothing, eats 1GB or more RAM. If you change alloc, that number might be, say, 500MB (albeit I don&#8217;t think so) &#8230; but thats still bad! Not to mention that less-fragmenting alloc will be slower by definition.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: adamo</title>
		<link>http://blog.pavlov.net/2007/11/21/malloc-replacements/#comment-634</link>
		<dc:creator>adamo</dc:creator>
		<pubDate>Thu, 22 Nov 2007 09:16:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.pavlov.net/2007/11/21/malloc-replacements/#comment-634</guid>
		<description>&lt;a href="http://www.research.att.com/~gsf/download/" rel="nofollow"&gt;vmalloc&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p><a href="http://www.research.att.com/~gsf/download/" rel="nofollow">vmalloc</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kelly</title>
		<link>http://blog.pavlov.net/2007/11/21/malloc-replacements/#comment-627</link>
		<dc:creator>Kelly</dc:creator>
		<pubDate>Thu, 22 Nov 2007 05:45:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.pavlov.net/2007/11/21/malloc-replacements/#comment-627</guid>
		<description>This isn't a drop-in replacement for malloc, but could probably be adapted to do that relatively easily though the algorithms sound similar to tcmalloc's:

http://library.gnome.org/devel/glib/unstable/glib-Memory-Slices.html
http://mail.gnome.org/archives/gtk-devel-list/2005-December/msg00031.html

Also based on some of the comments here: http://live.gnome.org/MemoryReduction
it might be possible to improve tcmalloc to better release mmapped blocks at least on linux and other unix systems. Right now it uses madvise(MADV_DONTNEED) which based on manpages for madvise probably just means the OS can swap it out rather than free it permanently, but I could be wrong.</description>
		<content:encoded><![CDATA[<p>This isn&#8217;t a drop-in replacement for malloc, but could probably be adapted to do that relatively easily though the algorithms sound similar to tcmalloc&#8217;s:</p>
<p><a href="http://library.gnome.org/devel/glib/unstable/glib-Memory-Slices.html" rel="nofollow">http://library.gnome.org/devel/glib/unstable/glib-Memory-Slices.html</a><br />
<a href="http://mail.gnome.org/archives/gtk-devel-list/2005-December/msg00031.html" rel="nofollow">http://mail.gnome.org/archives/gtk-devel-list/2005-December/msg00031.html</a></p>
<p>Also based on some of the comments here: <a href="http://live.gnome.org/MemoryReduction" rel="nofollow">http://live.gnome.org/MemoryReduction</a><br />
it might be possible to improve tcmalloc to better release mmapped blocks at least on linux and other unix systems. Right now it uses madvise(MADV_DONTNEED) which based on manpages for madvise probably just means the OS can swap it out rather than free it permanently, but I could be wrong.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pd</title>
		<link>http://blog.pavlov.net/2007/11/21/malloc-replacements/#comment-617</link>
		<dc:creator>pd</dc:creator>
		<pubDate>Thu, 22 Nov 2007 02:04:01 +0000</pubDate>
		<guid isPermaLink="false">http://blog.pavlov.net/2007/11/21/malloc-replacements/#comment-617</guid>
		<description>No idea if these are any good, just thought I'd try to help with a bit of Googling:

A Memory Allocator
http://g.oswego.edu/dl/html/malloc.html

A Comparison of Memory Allocators in Multiprocessors
http://developers.sun.com/solaris/articles/multiproc/multiproc.html

Hoard
http://www.hoard.org/
http://www.cs.umass.edu/~emery/hoard/

mmap
http://en.wikipedia.org/wiki/Mmap

The Memory Fragmentation Problem: Solved? (1997)
http://citeseer.ist.psu.edu/johnstone97memory.html

Keep up the great work</description>
		<content:encoded><![CDATA[<p>No idea if these are any good, just thought I&#8217;d try to help with a bit of Googling:</p>
<p>A Memory Allocator<br />
<a href="http://g.oswego.edu/dl/html/malloc.html" rel="nofollow">http://g.oswego.edu/dl/html/malloc.html</a></p>
<p>A Comparison of Memory Allocators in Multiprocessors<br />
<a href="http://developers.sun.com/solaris/articles/multiproc/multiproc.html" rel="nofollow">http://developers.sun.com/solaris/articles/multiproc/multiproc.html</a></p>
<p>Hoard<br />
<a href="http://www.hoard.org/" rel="nofollow">http://www.hoard.org/</a><br />
<a href="http://www.cs.umass.edu/~emery/hoard/" rel="nofollow">http://www.cs.umass.edu/~emery/hoard/</a></p>
<p>mmap<br />
<a href="http://en.wikipedia.org/wiki/Mmap" rel="nofollow">http://en.wikipedia.org/wiki/Mmap</a></p>
<p>The Memory Fragmentation Problem: Solved? (1997)<br />
<a href="http://citeseer.ist.psu.edu/johnstone97memory.html" rel="nofollow">http://citeseer.ist.psu.edu/johnstone97memory.html</a></p>
<p>Keep up the great work</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yusuf Goolamabbas</title>
		<link>http://blog.pavlov.net/2007/11/21/malloc-replacements/#comment-614</link>
		<dc:creator>Yusuf Goolamabbas</dc:creator>
		<pubDate>Thu, 22 Nov 2007 01:41:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.pavlov.net/2007/11/21/malloc-replacements/#comment-614</guid>
		<description>portable libumem:

https://labs.omniti.com/trac/portableumem</description>
		<content:encoded><![CDATA[<p>portable libumem:</p>
<p><a href="https://labs.omniti.com/trac/portableumem" rel="nofollow">https://labs.omniti.com/trac/portableumem</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>
