<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>ThingsILearned &#187; C</title>
	<atom:link href="http://thingsilearned.com/category/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://thingsilearned.com</link>
	<description>something new every day ... or so  By Dave Fowler</description>
	<lastBuildDate>Sun, 05 Feb 2012 18:47:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='thingsilearned.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>ThingsILearned &#187; C</title>
		<link>http://thingsilearned.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://thingsilearned.com/osd.xml" title="ThingsILearned" />
	<atom:link rel='hub' href='http://thingsilearned.com/?pushpress=hub'/>
		<item>
		<title>Electric Fence on OS X</title>
		<link>http://thingsilearned.com/2007/09/30/electric-fence-on-os-x/</link>
		<comments>http://thingsilearned.com/2007/09/30/electric-fence-on-os-x/#comments</comments>
		<pubDate>Mon, 01 Oct 2007 03:11:37 +0000</pubDate>
		<dc:creator>godavemon</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[thingsilearned]]></category>

		<guid isPermaLink="false">http://thingsilearned.wordpress.com/2007/09/30/electric-fence-on-os-x/</guid>
		<description><![CDATA[I recently suspected the dreaded buffer overrun in a project I&#8217;m hacking for work. These can be a huge pain to find, especially if your code has a considerable amount of mallocs and fails irregularly. After dismissing the urge to just write it all in python (wasn&#8217;t practical for the application) I decided to learn [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thingsilearned.com&amp;blog=1027874&amp;post=79&amp;subd=thingsilearned&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I recently suspected the dreaded buffer overrun in a project I&#8217;m hacking for work.  These can be a huge pain to find, especially if your code has a considerable amount of mallocs and fails irregularly.  After dismissing the urge to just write it all in python (wasn&#8217;t practical for the application) I decided to learn a malloc debugging tool.</p>
<p>I was excited to learn that macs come with their own malloc debuger, entitled Malloc Debugger.  How handy!  Through several attempts to use it on my application however I kept getting the same error.</p>
<p><em>Unable to read malloc information from (null)</em></p>
<p>I&#8217;m probably just missing some libraries to include that would have been had I been using Xcode.  Instead I was compiling with g++ -g.</p>
<p>Anyway, I eventually checked out <a href="http://linux.softpedia.com/get/Programming/Debuggers/Electric-Fence-3305.shtml">Electric Fence</a> (efence) and had decent results.  It didn&#8217;t compile right away, you have to comment out line 33 of page.c as stated in <a href="http://lists.apple.com/archives/xcode-users/2005/Oct/msg00791.html">this mailing list</a>.</p>
<p>Copy the compiled library libefence.a to /usr/lib/ and re-compile your application with the flag -lefence.</p>
<p>Upon execution it will spit out problems you have in your malloc code and die if there was a buffer overrun.  Its a great tool to turn on while you work as you&#8217;ll be informed of any overwrites as you&#8217;re developing.  Not after the whole thing is done and quitting at odd times <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p align="right">Dave</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/thingsilearned.wordpress.com/79/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/thingsilearned.wordpress.com/79/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/thingsilearned.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/thingsilearned.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/thingsilearned.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/thingsilearned.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/thingsilearned.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/thingsilearned.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/thingsilearned.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/thingsilearned.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/thingsilearned.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/thingsilearned.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/thingsilearned.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/thingsilearned.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/thingsilearned.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/thingsilearned.wordpress.com/79/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thingsilearned.com&amp;blog=1027874&amp;post=79&amp;subd=thingsilearned&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://thingsilearned.com/2007/09/30/electric-fence-on-os-x/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4b0e75fea564a9693a4592692e6baeb9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">godavemon</media:title>
		</media:content>
	</item>
	</channel>
</rss>
