<?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: OS X and virtual &#8220;bloat&#8221;</title>
	<atom:link href="http://blog.mozilla.com/dolske/2007/10/16/os-x-and-virtual-bloat/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mozilla.com/dolske/2007/10/16/os-x-and-virtual-bloat/</link>
	<description>The odd parity bit</description>
	<lastBuildDate>Mon, 02 Jan 2012 13:15:01 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Hoa</title>
		<link>http://blog.mozilla.com/dolske/2007/10/16/os-x-and-virtual-bloat/comment-page-1/#comment-17446</link>
		<dc:creator>Hoa</dc:creator>
		<pubDate>Wed, 17 Oct 2007 21:53:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/dolske/2007/10/16/os-x-and-virtual-bloat/#comment-17446</guid>
		<description>After I played a long time with mallocdebug/leaks and Mac OS X debugging stuff, I can say that those are really good tools.
- leaks can operate at runtime (when using MallocStackLogging, you can get the stack trace of allocation)
- the same for mallocdebug and it can tell you what memory blocks have been added between two moments.
- you can also have a look at objectalloc which is also useful for malloc besides being useful for objective-C object allocations. This may be a better user interface than mallocdebug</description>
		<content:encoded><![CDATA[<p>After I played a long time with mallocdebug/leaks and Mac OS X debugging stuff, I can say that those are really good tools.<br />
- leaks can operate at runtime (when using MallocStackLogging, you can get the stack trace of allocation)<br />
- the same for mallocdebug and it can tell you what memory blocks have been added between two moments.<br />
- you can also have a look at objectalloc which is also useful for malloc besides being useful for objective-C object allocations. This may be a better user interface than mallocdebug</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brendan Eich</title>
		<link>http://blog.mozilla.com/dolske/2007/10/16/os-x-and-virtual-bloat/comment-page-1/#comment-17443</link>
		<dc:creator>Brendan Eich</dc:creator>
		<pubDate>Wed, 17 Oct 2007 18:04:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/dolske/2007/10/16/os-x-and-virtual-bloat/#comment-17443</guid>
		<description>When I asked about IOKit, hyatt pointed me at

http://www.usenix.org/events/bsdcon02/full_papers/gerbarg/gerbarg_html/index.html

See section 6.

Large VM mappings are not free, they take up page table space. Probably not enough to worry about, but it depends on the OS.

/be</description>
		<content:encoded><![CDATA[<p>When I asked about IOKit, hyatt pointed me at</p>
<p><a href="http://www.usenix.org/events/bsdcon02/full_papers/gerbarg/gerbarg_html/index.html" rel="nofollow">http://www.usenix.org/events/bsdcon02/full_papers/gerbarg/gerbarg_html/index.html</a></p>
<p>See section 6.</p>
<p>Large VM mappings are not free, they take up page table space. Probably not enough to worry about, but it depends on the OS.</p>
<p>/be</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Walden</title>
		<link>http://blog.mozilla.com/dolske/2007/10/16/os-x-and-virtual-bloat/comment-page-1/#comment-17435</link>
		<dc:creator>Jeff Walden</dc:creator>
		<pubDate>Wed, 17 Oct 2007 11:40:59 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/dolske/2007/10/16/os-x-and-virtual-bloat/#comment-17435</guid>
		<description>Wait, you put an after-the-break link to *not* annoy planet.mozilla.org readers?  Thanks for forcing me to break out of my feed reader!  :-P</description>
		<content:encoded><![CDATA[<p>Wait, you put an after-the-break link to *not* annoy planet.mozilla.org readers?  Thanks for forcing me to break out of my feed reader!  :-P</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Justin Dolske</title>
		<link>http://blog.mozilla.com/dolske/2007/10/16/os-x-and-virtual-bloat/comment-page-1/#comment-17434</link>
		<dc:creator>Justin Dolske</dc:creator>
		<pubDate>Wed, 17 Oct 2007 10:11:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/dolske/2007/10/16/os-x-and-virtual-bloat/#comment-17434</guid>
		<description>Hao:

Yikes, I can&#039;t believe I overlooked the &quot;-resident&quot; flag for vmmap! Very useful. It does seem to confirm my suspicion that most of the biggest VM regions are not being used. Basically what one would expect, but now with numbers to prove it.

I deliberately avoided getting unto examining malloc usage; that&#039;s a topic for some other blog post! Rather, the interesting data point here is how much *isn&#039;t* being used. I&#039;ve been planning to poke around with libumem on Solaris, and it would be interesting to compare its capabilities with libMallocDebug and leaks(1)... in a different blog post. :-)


Håkan:

Yeah, IOKit is what originally motived me to post this, as it looked like an interesting example of how &quot;cost&quot; can mean different things in different contexts. It felt unlikely to be a serious problem (I think we would have noticed if OS X was thrashing around an extra 256MB, compared to Linux/Windows), not to mention the &quot;vmmap -resident&quot; data. But still, it does have some sort of cost, as measured by the impression users get if they look at the VM size and think Firefox is using gobs of memory.

Eliminating or pruning IOKit would reduce that &quot;cost&quot;... But it&#039;s sort of bullshit performance tuning (because the only effect is in someone&#039;s head, and I think we&#039;re far more interested in real gains). Then again, a big reduction in a fairly visible and confusing number like VSIZE might we worth taking if it was easy. I&#039;d first want to understand it better.

Finally (phew!), yes, most of the framework and system stuff should be shared data, and so the real cost of having it in physical memory is spread across all the processes sharing it. Yet another reason why a single number like VSIZE doesn&#039;t tell the whole story!</description>
		<content:encoded><![CDATA[<p>Hao:</p>
<p>Yikes, I can&#8217;t believe I overlooked the &#8220;-resident&#8221; flag for vmmap! Very useful. It does seem to confirm my suspicion that most of the biggest VM regions are not being used. Basically what one would expect, but now with numbers to prove it.</p>
<p>I deliberately avoided getting unto examining malloc usage; that&#8217;s a topic for some other blog post! Rather, the interesting data point here is how much *isn&#8217;t* being used. I&#8217;ve been planning to poke around with libumem on Solaris, and it would be interesting to compare its capabilities with libMallocDebug and leaks(1)&#8230; in a different blog post. :-)</p>
<p>Håkan:</p>
<p>Yeah, IOKit is what originally motived me to post this, as it looked like an interesting example of how &#8220;cost&#8221; can mean different things in different contexts. It felt unlikely to be a serious problem (I think we would have noticed if OS X was thrashing around an extra 256MB, compared to Linux/Windows), not to mention the &#8220;vmmap -resident&#8221; data. But still, it does have some sort of cost, as measured by the impression users get if they look at the VM size and think Firefox is using gobs of memory.</p>
<p>Eliminating or pruning IOKit would reduce that &#8220;cost&#8221;&#8230; But it&#8217;s sort of bullshit performance tuning (because the only effect is in someone&#8217;s head, and I think we&#8217;re far more interested in real gains). Then again, a big reduction in a fairly visible and confusing number like VSIZE might we worth taking if it was easy. I&#8217;d first want to understand it better.</p>
<p>Finally (phew!), yes, most of the framework and system stuff should be shared data, and so the real cost of having it in physical memory is spread across all the processes sharing it. Yet another reason why a single number like VSIZE doesn&#8217;t tell the whole story!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Håkan Waara</title>
		<link>http://blog.mozilla.com/dolske/2007/10/16/os-x-and-virtual-bloat/comment-page-1/#comment-17431</link>
		<dc:creator>Håkan Waara</dc:creator>
		<pubDate>Wed, 17 Oct 2007 08:32:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/dolske/2007/10/16/os-x-and-virtual-bloat/#comment-17431</guid>
		<description>IIRC we link IOKit into widget just for something silly like the idle service. If it&#039;s costing us a lot, maybe we should reconsider? 

Shouldn&#039;t most of these frameworks (which by and large are just collections of shared libraries) be in shared memory anyway? Or is this the allocation of private memory every user of these shared libraries need to put up with?

/H</description>
		<content:encoded><![CDATA[<p>IIRC we link IOKit into widget just for something silly like the idle service. If it&#8217;s costing us a lot, maybe we should reconsider? </p>
<p>Shouldn&#8217;t most of these frameworks (which by and large are just collections of shared libraries) be in shared memory anyway? Or is this the allocation of private memory every user of these shared libraries need to put up with?</p>
<p>/H</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hoa</title>
		<link>http://blog.mozilla.com/dolske/2007/10/16/os-x-and-virtual-bloat/comment-page-1/#comment-17429</link>
		<dc:creator>Hoa</dc:creator>
		<pubDate>Wed, 17 Oct 2007 08:26:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/dolske/2007/10/16/os-x-and-virtual-bloat/#comment-17429</guid>
		<description>Hello,

1. For malloc memory:
On Mac OS X, you can use MallocDebug:
/Developer/Applications/Performance\ Tools/MallocDebug.app

You have to preload libMallocDebug when you are running your application:
export DYLD_INSERT_LIBRARIES=/usr/lib/libMallocDebug.A.dylib

MallocDebug can show where the malloc allocation were initiated. So that you can know where most of malloc memory is going.

2. For other memory:

$ vmmap -resident 
REGION TYPE             [ VIRTUAL/RESIDENT]
===========             [ =======/========]
ATS (font support)      [  33856K/   1076K]
Carbon                  [   1144K/   1144K]
CoreGraphics            [   5016K/   3232K]
IOKit                   [ 262144K/      0K]
MALLOC                  [  33884K/  21944K]
STACK GUARD             [     48K/      0K]
Stack                   [  14336K/    152K]
VM_ALLOCATE ?           [   2028K/    608K]
__DATA                  [   5300K/   3244K]
__IMAGE                 [   1088K/    480K]
__IMPORT                [    500K/    500K]
__LINKEDIT              [  18328K/  18028K]
__OBJC                  [    864K/    848K]
__PAGEZERO              [      4K/      0K]
__TEXT                  [  83044K/  47560K]
mapped file             [  13476K/   7700K]
shared memory           [  16376K/    128K]

in short, that shows that IOKit allocation is only address space allocation and it seems that it is never mapped into real memory. So that we can ignore IOKit allocation.

It looks like your output has much mapped file address space:
You can know which files are mapped using the following:

$ vmmap -w -resident  &#124; grep mapped
mapped file            00fcd000-00fe1000 [   80K/   76K] r--/rwx SM=COW  /System/Library/CoreServices/CharacterSets/CFUnicodeData-L.mapping
mapped file            0185d000-018b4000 [  348K/  348K] r--/rwx SM=COW  /System/Library/CoreServices/CharacterSets/CFCharacterSetBitmaps.bitmap
mapped file            12808000-1280d000 [   20K/    8K] r--/rwx SM=COW  /System
...</description>
		<content:encoded><![CDATA[<p>Hello,</p>
<p>1. For malloc memory:<br />
On Mac OS X, you can use MallocDebug:<br />
/Developer/Applications/Performance\ Tools/MallocDebug.app</p>
<p>You have to preload libMallocDebug when you are running your application:<br />
export DYLD_INSERT_LIBRARIES=/usr/lib/libMallocDebug.A.dylib</p>
<p>MallocDebug can show where the malloc allocation were initiated. So that you can know where most of malloc memory is going.</p>
<p>2. For other memory:</p>
<p>$ vmmap -resident<br />
REGION TYPE             [ VIRTUAL/RESIDENT]<br />
===========             [ =======/========]<br />
ATS (font support)      [  33856K/   1076K]<br />
Carbon                  [   1144K/   1144K]<br />
CoreGraphics            [   5016K/   3232K]<br />
IOKit                   [ 262144K/      0K]<br />
MALLOC                  [  33884K/  21944K]<br />
STACK GUARD             [     48K/      0K]<br />
Stack                   [  14336K/    152K]<br />
VM_ALLOCATE ?           [   2028K/    608K]<br />
__DATA                  [   5300K/   3244K]<br />
__IMAGE                 [   1088K/    480K]<br />
__IMPORT                [    500K/    500K]<br />
__LINKEDIT              [  18328K/  18028K]<br />
__OBJC                  [    864K/    848K]<br />
__PAGEZERO              [      4K/      0K]<br />
__TEXT                  [  83044K/  47560K]<br />
mapped file             [  13476K/   7700K]<br />
shared memory           [  16376K/    128K]</p>
<p>in short, that shows that IOKit allocation is only address space allocation and it seems that it is never mapped into real memory. So that we can ignore IOKit allocation.</p>
<p>It looks like your output has much mapped file address space:<br />
You can know which files are mapped using the following:</p>
<p>$ vmmap -w -resident  | grep mapped<br />
mapped file            00fcd000-00fe1000 [   80K/   76K] r&#8211;/rwx SM=COW  /System/Library/CoreServices/CharacterSets/CFUnicodeData-L.mapping<br />
mapped file            0185d000-018b4000 [  348K/  348K] r&#8211;/rwx SM=COW  /System/Library/CoreServices/CharacterSets/CFCharacterSetBitmaps.bitmap<br />
mapped file            12808000-1280d000 [   20K/    8K] r&#8211;/rwx SM=COW  /System<br />
&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fredrik</title>
		<link>http://blog.mozilla.com/dolske/2007/10/16/os-x-and-virtual-bloat/comment-page-1/#comment-17428</link>
		<dc:creator>fredrik</dc:creator>
		<pubDate>Wed, 17 Oct 2007 07:45:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/dolske/2007/10/16/os-x-and-virtual-bloat/#comment-17428</guid>
		<description>Tautology alert: &quot;a large virtual memory size may or may be a problem&quot;.

&lt;em&gt;[fixed, thanks :-) --dolske]&lt;/em&gt;</description>
		<content:encoded><![CDATA[<p>Tautology alert: &#8220;a large virtual memory size may or may be a problem&#8221;.</p>
<p><em>[fixed, thanks :-) --dolske]</em></p>
]]></content:encoded>
	</item>
</channel>
</rss>

