<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>An Experiment in Bloggery &#187; RAM</title>
	<atom:link href="http://kevin.sb.org/tag/ram/feed/" rel="self" type="application/rss+xml" />
	<link>http://kevin.sb.org</link>
	<description>The occasional view into my life</description>
	<lastBuildDate>Fri, 09 Sep 2011 00:19:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Activity Monitor leaks</title>
		<link>http://kevin.sb.org/2006/11/16/activity-monitor-leaks/</link>
		<comments>http://kevin.sb.org/2006/11/16/activity-monitor-leaks/#comments</comments>
		<pubDate>Thu, 16 Nov 2006 09:58:00 +0000</pubDate>
		<dc:creator>Kevin Ballard</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Activity Monitor]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[leaks]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[pmTool]]></category>
		<category><![CDATA[RAM]]></category>

		<guid isPermaLink="false">http://95c4900c-c03d-4ea8-9fba-4b73271f1d1c</guid>
		<description><![CDATA[Note: Mac OS X 10.4.9 seems to fix the bug described here. pmTool, the process run by Activity Monitor to actually collect stats, appears to leak memory. If I leave Activity Monitor running for a good period of time, when I check up on it pmTool is often using over 100MiB of Real Memory. I [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Note</strong>: Mac OS X 10.4.9 seems to fix the bug described here.</p>

<p><code>pmTool</code>, the process run by Activity Monitor to actually collect stats, appears to leak memory. If I leave Activity Monitor running for a good period of time, when I check up on it <code>pmTool</code> is often using over 100MiB of Real Memory.</p>

<p>I just checked my laptop, <code>pmTool</code> was using over 100MiB of Real Memory. Right now on my desktop it&#8217;s using 41MiB of Real Memory, but I don&#8217;t remember how long it&#8217;s been running for. I also believe a good deal of memory is currently paged out.</p>

<p>After checking up on it, <code>pmTool</code> on my desktop has a Private Memory size of 91MiB.</p>

<p><span id="more-115"></span></p>

<p>If I run <code>leaks</code> on <code>pmTool</code> on my desktop, I see 27931 leaks for 85799936 total leaked bytes, which works out to about 81.8MiB of leaked memory. All but 2 of these leaks appear to be blocks of memory of size 3072 that start with <code>'?\0'</code>.</p>

<p>In any case, this seems to be a pretty significant leak in pmTool.</p>

<p>A highly non-scientific test shows it to be adding one new leak every time the UI in Activity Monitor updates (default is every 2 seconds). So if you haven&#8217;t changed the update frequency then <code>pmTool</code> will leak 3KiB of memory every 2 seconds.</p>

<p>That&#8217;s a lot.</p>

<p>I haven&#8217;t noticed <code>pmTool</code> taking more than about 100MiB of Real Memory so far, but I never thought to check Private Memory until now so it may have simply been paging out a lot of leaks. If my calculations are correct, every 24 hours <code>pmTool</code> will have leaked 126.6MiB.</p>

<p>If you keep Activity Monitor running constantly like I do, you may want to check what your current memory usage is. If you see anything close to what I am, you may want to re-evaluate the importance of Activity Monitor (or set up a cron job to periodically restart Activity Monitor). On the other hand if you&#8217;re not seeing a leak problem I&#8217;d be interested to hear the details of your system (I&#8217;m currently running OS X 10.4.8). I&#8217;m not entirely certain whether this leak is Apple&#8217;s fault or whether one of the myriad customizations to my system is somehow causing this. As far as I know none of the hacks I use that inject into other code processes affect pmTool (seeing as how it&#8217;s not an AppKit application, so it doesn&#8217;t load Input Managers, and it&#8217;s run as root so it won&#8217;t be affected by anything that tries code injection), so this seems likely to be Apple&#8217;s fault, but if so I&#8217;m really surprised that they haven&#8217;t fixed it.</p>

<p><strong>Update</strong>: I just checked the current memory usage of <code>pmTool</code>. I haven&#8217;t restarted it in at least a day, and yet it was listing a reasonable 1.2MiB of Real memory, and roughly the same Private Memory. This is the memory usage I&#8217;d want it to have, and yet completely different than the observed behaviour I documented in this post. I double-checked and the memory usage on my laptop was up to 55MiB. I wish I had thought of running <code>leaks</code> on <code>pmTool</code> when I saw this, but instead I quit and relaunched Activity Monitor, and immediately the leaky behaviour came back.</p>

<p><strong>Update 2</strong>: I feel silly now. I completely forgot I&#8217;d set up a root crontab entry with <code>@hourly killall pmTool</code> to minimize the leak. That&#8217;s why it was showing such a small memory usage.</p>

<p><strong>Update 3</strong>: I just got a brand new 2GHz Core 2 Duo MacBook, running 10.4.8 with the latest security update (i.e. the same OS as my iMac), and quite mysteriously, this leak isn&#8217;t showing itself. pmTool has a respectable 960KiB of Real memory usage, and no leaks. I can&#8217;t explain it.</p>
]]></content:encoded>
			<wfw:commentRss>http://kevin.sb.org/2006/11/16/activity-monitor-leaks/feed/</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
