<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>mikeash.com pyblog/friday-qa-2009-06-19-mac-os-x-process-memory-statistics.html comments</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2009-06-19-mac-os-x-process-memory-statistics.html#comments</link><description>mikeash.com Recent Comments</description><lastBuildDate>Sat, 06 Jun 2026 20:42:56 GMT</lastBuildDate><generator>PyRSS2Gen-1.0.0</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>mikeash - 2009-07-10 11:14:18</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2009-06-19-mac-os-x-process-memory-statistics.html#comments</link><description>On my system, at least, the most common cause of IO-based slowdown is swap, which in turn is caused by memory exhaustion. I've seen Time Machine and other such things make the machine slow as well, but not as frequently and not as dramatically. Much will depend on your hardware and your individual usage habits, of course.</description><guid isPermaLink="true">da2b83b7a859f649fb44b86f48feeca2</guid><pubDate>Fri, 10 Jul 2009 11:14:18 GMT</pubDate></item><item><title>Levi Figueira - 2009-07-10 10:57:34</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2009-06-19-mac-os-x-process-memory-statistics.html#comments</link><description>@juancn is SOOO right... Usually when the system is having a major slowdown, it is caused by high disk usage *not* RAM issues...
&lt;br /&gt;
&lt;br /&gt;I keep wondering why a why to monitor per process disk activity is not integrated with the Activity Monitor (just the totals... not very helpful).
&lt;br /&gt;
&lt;br /&gt;From my experience, the cause for major system slowdows are apps like Time Machine (local) or Backblaze (online) and other backup apps, or Spotlight and other search/indexing utilities... Those reaaaally bog down my machine and are really hard to track down/stop.
&lt;br /&gt;
&lt;br /&gt;This article is such an enlightening read, but it comes down to: it's very hard to track *real* memory usage, because... there's no such thing! ;) haha It's soo complicated and "abstract"...
&lt;br /&gt;
&lt;br /&gt;Thanks for the tip on iotop, juancn! :)</description><guid isPermaLink="true">cdbf5897880a477aa6cc01ea38f773d1</guid><pubDate>Fri, 10 Jul 2009 10:57:34 GMT</pubDate></item><item><title>juancn - 2009-06-30 21:30:56</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2009-06-19-mac-os-x-process-memory-statistics.html#comments</link><description>One command that can be very useful finding which process is slowing down your machine is "iotop".
&lt;br /&gt;
&lt;br /&gt;You run it like this:
&lt;br /&gt;
&lt;br /&gt;~&amp;gt;sudo iotop -P
&lt;br /&gt;
&lt;br /&gt;And it displays a % of disk IO each process is using :)
&lt;br /&gt;
&lt;br /&gt;CPU usage is easy to see in activity monitor or by using top. But disk I/O is usually hard to track down.
&lt;br /&gt;</description><guid isPermaLink="true">bd30940cb78051218b837ac2027189f3</guid><pubDate>Tue, 30 Jun 2009 21:30:56 GMT</pubDate></item><item><title>Andrew - 2009-06-22 21:13:10</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2009-06-19-mac-os-x-process-memory-statistics.html#comments</link><description>@scott: in fairness, re Firefox's historical memory leaks/allocation schemes...
&lt;br /&gt;
&lt;br /&gt;&lt;a href="http://dotnetperls.com/browser-memory"&gt;http://dotnetperls.com/browser-memory&lt;/a&gt; and 
&lt;br /&gt;&lt;a href="http://dotnetperls.com/chrome-memory"&gt;http://dotnetperls.com/chrome-memory&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;This matches my experience, since the 3.0 release.  FF has cleaned up its act.
&lt;br /&gt;
&lt;br /&gt;e.g., Firefox running for 13 days, presently about 80 tabs open:
&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogcommentquote"&gt;&lt;div class="blogcommentquoteinner"&gt;
&lt;br /&gt;&amp;nbsp;&amp;nbsp;PID COMMAND      %CPU   TIME   #TH #PRTS #MREGS RPRVT  RSHRD  RSIZE  VSIZE
&lt;br /&gt;&amp;nbsp;&amp;nbsp;460 firefox-bi  10.7% 31:29:37  26   277   6391  338M    50M   490M   939M
&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;(CPU usage hovers between 10-20%, probably Flash and javascript cruft that just keeps churning in unviewed tabs)
&lt;br /&gt;
&lt;br /&gt;I also find it useful to keep separate profiles  (run /Applications/Firefox.app/Contents/MacOS/firefox-bin --profilemanager
&lt;br /&gt;&amp;nbsp;from Terminal), one profile for regular browsing with just a few plugins enabled, and another for web dev work with firebug, html validators, etc.
&lt;br /&gt;</description><guid isPermaLink="true">96e8dce2b5954b1139af981d1eff87e4</guid><pubDate>Mon, 22 Jun 2009 21:13:10 GMT</pubDate></item><item><title>Mike Smith - 2009-06-21 00:54:00</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2009-06-19-mac-os-x-process-memory-statistics.html#comments</link><description>@ssp
&lt;br /&gt;
&lt;br /&gt;It's nice to pine for the "good old days", but the Darwin memory manager is nothing like the 9 memory manager, and Mac OS X apps tend to have more complex behaviours than their Classic ancestors, so the situation overall just isn't as straightforward anymore.
&lt;br /&gt;
&lt;br /&gt;@natevw
&lt;br /&gt;
&lt;br /&gt;As Jean-Daniel explains, shared libraries are internally subdivided based on (amongst other things) their writability.  It's worth noting that the parts that might be writable but which have not yet been written remain shared using a technique called copy-on-write (often abbreviated COW).
&lt;br /&gt;
&lt;br /&gt;@chuck
&lt;br /&gt;
&lt;br /&gt;The accounting used to maintain those numbers is complicated, and they are not directly derived one from the others.  It may help to know that most shared libraries are kept in what is known as the "shared segment", and the system uses a trick to share portions of the pmap and VM pagetable (data structures used by the MMU) that correspond to this segment between processes.  This is a healthy performance optimisation, but it means that updates made to these data structures cannot be trivially accounted for across all processes.
&lt;br /&gt;
&lt;br /&gt;In particular, RSIZE is very difficult to account precisely.  If one task causes a page to be made present in a shared library, it's reasonable to charge that task for the page.  If another task then uses that page, it might be reasonable to charge it for it as well, but there is no event that tells the system the second task has used the page.  Further, when the page is later evicted and recycled, there is no list of all the tasks that used the page.  Indeed, once it's made present, it's present in all tasks.  Do you account a resident page in the shared segment against every task in the system?  That would make the number useless, as one task running lots of code in a framework would make it look like every task in the system was blowing out its resident set.
&lt;br /&gt;
&lt;br /&gt;Instead, RSIZE is managed using several tricks that try to make it 'relevant' at the cost of being 'precise'.  You're encouraged to read the source code for the details.
&lt;br /&gt;
&lt;br /&gt;@Miles
&lt;br /&gt;
&lt;br /&gt;The act of "inspecting" a process causes a large chunk of its address space to be shared with the tool inspecting it, and so it goes from being accounted as VSIZE to VSHARED.  You'll note that if you quit and restart Activity Monitor, the VSIZE accounting pops back up to where it was.
&lt;br /&gt;
&lt;br /&gt;</description><guid isPermaLink="true">5178aca6e328e824e0caa7e2d3a36aeb</guid><pubDate>Sun, 21 Jun 2009 00:54:00 GMT</pubDate></item><item><title>mikeash - 2009-06-20 23:39:45</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2009-06-19-mac-os-x-process-memory-statistics.html#comments</link><description>The Activity Monitor global system memory terms are &lt;i&gt;clearly&lt;/i&gt; explained in the help. Please RTFM.
&lt;br /&gt;
&lt;br /&gt;&lt;b&gt;Chuck:&lt;/b&gt; Any given chunk of physical RAM could be mapped 0 or more times into the process.
&lt;br /&gt;
&lt;br /&gt;For questions about CPU usage and such, I think you're in the wrong place. This is a programming blog.</description><guid isPermaLink="true">2d7563ec1fc52345dfc79aa7ca6e8d91</guid><pubDate>Sat, 20 Jun 2009 23:39:45 GMT</pubDate></item><item><title>Jean-Daniel Dupas - 2009-06-20 18:26:10</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2009-06-19-mac-os-x-process-memory-statistics.html#comments</link><description>&lt;div class="blogcommentquote"&gt;&lt;div class="blogcommentquoteinner"&gt;If system libraries are shared via shared memory, how is process-specific state kept separate?&lt;/div&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;Shared library are composed of multiple sections. One with the code (read-only), one with the process specific state (read-write) (global variables) etc.
&lt;br /&gt;
&lt;br /&gt;And only the "read-only" sections are shared.
&lt;br /&gt;
&lt;br /&gt;In useful tool list, it's worth to mention MallocDebug too.</description><guid isPermaLink="true">6becedc0a47743d4acfb052ec6aceb48</guid><pubDate>Sat, 20 Jun 2009 18:26:10 GMT</pubDate></item><item><title>Matthew Kosterman - 2009-06-20 11:33:55</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2009-06-19-mac-os-x-process-memory-statistics.html#comments</link><description>I'd love to know how to figure out which process(es) is/are "stuck" when this is reported in TOP. It seems as though whenever my machine is behaving erratically, with inexplicable pauses in execution, I can run TOP and I will see one or more "stuck" processes in the header info.
&lt;br /&gt;
&lt;br /&gt;I've searched all over and not come up with much info other than what I can summarize as: it doesn't necessarily mean something bad, it just means a program is waiting for something.
&lt;br /&gt;
&lt;br /&gt;It would be nice to know which program and what its waiting for.....</description><guid isPermaLink="true">a447f53f99348d5521377d720f4bc5b0</guid><pubDate>Sat, 20 Jun 2009 11:33:55 GMT</pubDate></item><item><title>Miles - 2009-06-20 07:39:46</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2009-06-19-mac-os-x-process-memory-statistics.html#comments</link><description>Here's what I've always wondered: In Activity Monitor, why does the "Virtual Memory" number for a process drop by about 568MB for a process when you inspect it?</description><guid isPermaLink="true">289cf6149a06e8bb65c8c530d6f3e28d</guid><pubDate>Sat, 20 Jun 2009 07:39:46 GMT</pubDate></item><item><title>Chuck - 2009-06-20 06:57:58</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2009-06-19-mac-os-x-process-memory-statistics.html#comments</link><description>I just can't see why, by your definition of RPRVT, RSHRD and RSIZE, RSIZE is not equal to RPRVT+RSHRD.
&lt;br /&gt;RSIZE measures actual memory, but you said RPRVT is the amount of address space, local to the process, &lt;b&gt;which corresponds to items currently present in physical RAM.&lt;/b&gt;
&lt;br /&gt;
&lt;br /&gt;I'm sure I'm just missing something </description><guid isPermaLink="true">3203e84e299e231eff96830271c2d77c</guid><pubDate>Sat, 20 Jun 2009 06:57:58 GMT</pubDate></item><item><title>natevw - 2009-06-20 06:54:36</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2009-06-19-mac-os-x-process-memory-statistics.html#comments</link><description>If system libraries are shared via shared memory, how is process-specific state kept separate?</description><guid isPermaLink="true">65d5ecbbd2b975e2b6969c61f3e3a4d9</guid><pubDate>Sat, 20 Jun 2009 06:54:36 GMT</pubDate></item><item><title>Nick - 2009-06-20 06:45:52</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2009-06-19-mac-os-x-process-memory-statistics.html#comments</link><description>Tom Vanderlinden: Nice" in the the CPU tab is also a mystery
&lt;br /&gt;
&lt;br /&gt;"nice" is scheduling priority, try 'man nice' in a terminal or &lt;a href="http://en.wikipedia.org/wiki/Nice_"&gt;http://en.wikipedia.org/wiki/Nice_&lt;/a&gt;(Unix)</description><guid isPermaLink="true">02c17cfb7b920011371f7adf6748c4df</guid><pubDate>Sat, 20 Jun 2009 06:45:52 GMT</pubDate></item><item><title>Tom Vanderlinden - 2009-06-20 06:06:14</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2009-06-19-mac-os-x-process-memory-statistics.html#comments</link><description>Could you take one more step and translate the Activity Monitor terms used in the System Memory tab:
&lt;br /&gt;Wired
&lt;br /&gt;Active
&lt;br /&gt;Inactive
&lt;br /&gt;Used
&lt;br /&gt;Free
&lt;br /&gt;Vm size:
&lt;br /&gt;Page ins/outs
&lt;br /&gt;
&lt;br /&gt;"Nice" in the the CPU tab is also a mystery,
&lt;br /&gt;but I suppose that is another subject.</description><guid isPermaLink="true">68f3d2313605dacb42acec4a858d0947</guid><pubDate>Sat, 20 Jun 2009 06:06:14 GMT</pubDate></item><item><title>ssp - 2009-06-20 05:52:22</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2009-06-19-mac-os-x-process-memory-statistics.html#comments</link><description>One of the nicest explanations of the mythical numbers I have seen, thanks.
&lt;br /&gt;
&lt;br /&gt;Yet - and I have been wondering about this for years - my main question "which number corresponds to the number displayed by Mac OS 9" still remained unanswered, or rather answered as 'none'. 
&lt;br /&gt;
&lt;br /&gt;Which is a shame because the OS 9 numbers were actually useful in the sense that they told me which application would be worth quitting when running into swapping hell. In OS X I have to intuitively quit notorious memory hogs like iPhoto or VMWare but it seems to be impossible to collect reasonable information about which application is most worth quitting from these numbers.</description><guid isPermaLink="true">c55a7e44cfdedd7f18998fee829e9570</guid><pubDate>Sat, 20 Jun 2009 05:52:22 GMT</pubDate></item><item><title>Jon - 2009-06-20 05:46:02</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2009-06-19-mac-os-x-process-memory-statistics.html#comments</link><description>How do these terms relate to the terms used in activity manager. Is private the same as wired?</description><guid isPermaLink="true">2e8d1b0d1917483764f92063f2e86953</guid><pubDate>Sat, 20 Jun 2009 05:46:02 GMT</pubDate></item><item><title>Marc - 2009-06-20 04:07:37</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2009-06-19-mac-os-x-process-memory-statistics.html#comments</link><description>Scott: nice one :-)</description><guid isPermaLink="true">733faae81af53334187ef270d57128ee</guid><pubDate>Sat, 20 Jun 2009 04:07:37 GMT</pubDate></item><item><title>Scott - 2009-06-20 04:05:40</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2009-06-19-mac-os-x-process-memory-statistics.html#comments</link><description>&lt;i&gt;A common question is "which apps are making my machine slow or filling up my RAM?" Of course,&lt;/i&gt;
&lt;br /&gt;
&lt;br /&gt;the answer is "Firefox"
&lt;br /&gt;
&lt;br /&gt;:-)
&lt;br /&gt;
&lt;br /&gt;Thanks for the information!</description><guid isPermaLink="true">760dfe59567a1192808e39923051f26f</guid><pubDate>Sat, 20 Jun 2009 04:05:40 GMT</pubDate></item><item><title>Nick - 2009-06-20 03:00:47</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2009-06-19-mac-os-x-process-memory-statistics.html#comments</link><description>A common question is "which apps are making my machine slow or filling up my RAM?" Of course, this is a difficult question, but I think that RPRVT is the right single number to look at.</description><guid isPermaLink="true">901e653371b1a546fcb61d95373cde84</guid><pubDate>Sat, 20 Jun 2009 03:00:47 GMT</pubDate></item><item><title>Bryce - 2009-06-19 23:31:20</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2009-06-19-mac-os-x-process-memory-statistics.html#comments</link><description>Very clear and helpful. Thanks!</description><guid isPermaLink="true">47d4163f92b80dbf84551fc2fa5b48e3</guid><pubDate>Fri, 19 Jun 2009 23:31:20 GMT</pubDate></item></channel></rss>
