<?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>stealthcopter.com &#187; memory</title>
	<atom:link href="http://www.stealthcopter.com/blog/tag/memory/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stealthcopter.com/blog</link>
	<description>Android, Linux, Python and stealthcopters</description>
	<lastBuildDate>Sat, 24 Jul 2010 00:01:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Free</title>
		<link>http://www.stealthcopter.com/blog/2009/05/free/</link>
		<comments>http://www.stealthcopter.com/blog/2009/05/free/#comments</comments>
		<pubDate>Sun, 17 May 2009 19:24:34 +0000</pubDate>
		<dc:creator>mat</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.stealthcopter.com/blog/?p=61</guid>
		<description><![CDATA[Using the free command gives output something like this (-m just tells free to output in megabytes): free -m total used free shared buffers cached Mem: 2013 1996 17 0 27 1381 -/+ buffers/cache: 588 1425 Swap: 956 0 956 This is useful but annoying as it doesn&#8217;t show you how much memory is actually [...]]]></description>
			<content:encoded><![CDATA[<p>Using the free command gives output something like this (-m just tells free to output in megabytes):</p>
<blockquote><p>
free -m<br />
             total       used       free     shared    buffers     cached<br />
Mem:          2013       1996         17          0         27       1381<br />
-/+ buffers/cache:        588       1425<br />
Swap:          956          0        956
</p></blockquote>
<p>This is useful but annoying as it doesn&#8217;t show you how much memory is actually free. Files that are used are kept in the ram (referred to as caching). If the memory is needed it is simply overwritten, however if the file is used again it is already in the memory which saves time. </p>
<p>I wrote a quick little bash line to get the actually memory in use or the actual memory free. I use grep to select the right line from the output of free, and then use awk to do the string manipulation and math.</p>
<p>Memory in use</p>
<blockquote><p>free -m | grep Mem | awk &#8216;{x=$3-$7; print x}&#8217;</p></blockquote>
<p>Memory free</p>
<blockquote><p>free -m | grep Mem | awk &#8216;{x=$2-($3-$7); print x}&#8217;</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.stealthcopter.com/blog/2009/05/free/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
