<?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>Perplexed Labs &#187; memory leak</title>
	<atom:link href="http://blog.perplexedlabs.com/tag/memory-leak/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.perplexedlabs.com</link>
	<description>web development war stories from the frontlines to the backend</description>
	<lastBuildDate>Thu, 09 Sep 2010 17:11:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>PHP garbage collection and memory leaks</title>
		<link>http://blog.perplexedlabs.com/2008/02/25/php-garbage-collection-and-memory-leaks/</link>
		<comments>http://blog.perplexedlabs.com/2008/02/25/php-garbage-collection-and-memory-leaks/#comments</comments>
		<pubDate>Mon, 25 Feb 2008 17:57:33 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[garbage collection]]></category>
		<category><![CDATA[memory leak]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.perplexedlabs.com/2008/02/25/php-garbage-collection-and-memory-leaks/</guid>
		<description><![CDATA[Been working on a command line script that takes days to finish execution (yes, DAYS).  Unfortunately, it had a healthy flow of memory leaking. It would fatally crash with your typical "out of memory" error. I spent hours debugging the potential source - free'd results of mysql queries, unset variables, you name it I tried [...]


Related posts:<ol><li><a href='http://blog.perplexedlabs.com/2009/05/04/php-jquery-ajax-javascript-long-polling/' rel='bookmark' title='Permanent Link: PHP jQuery AJAX Javascript Long Polling'>PHP jQuery AJAX Javascript Long Polling</a></li>
<li><a href='http://blog.perplexedlabs.com/2008/02/06/mutex-with-php-and-mysql/' rel='bookmark' title='Permanent Link: Mutex with PHP and mySQL'>Mutex with PHP and mySQL</a></li>
<li><a href='http://blog.perplexedlabs.com/2008/02/04/php-simple-profiling-class/' rel='bookmark' title='Permanent Link: PHP Simple Profiling Class'>PHP Simple Profiling Class</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Been working on a command line script that takes days to finish execution (yes, DAYS).  Unfortunately, it had a healthy flow of memory leaking.  It would fatally crash with your typical "out of memory" error.</p>
<p>I spent hours debugging the potential source - free'd results of mysql queries, unset variables, you name it I tried it.  I kind of gave up and instead chose to add in a "start at" parameter so that I could just re-execute and jump back in to the loop where it crashed last time.</p>
<p>Today, through natural processes of improving functionality and cleaning code, I moved the block of code that was leaking memory into a function so that it could be recycled elsewhere.  <strong>By simply moving the code into a function I suspect PHP now garbage collects after each call and memory no longer hemorrhages from its veins.</strong></p>
<p>I hope this helps someone else out there!</p>


<p>Related posts:<ol><li><a href='http://blog.perplexedlabs.com/2009/05/04/php-jquery-ajax-javascript-long-polling/' rel='bookmark' title='Permanent Link: PHP jQuery AJAX Javascript Long Polling'>PHP jQuery AJAX Javascript Long Polling</a></li>
<li><a href='http://blog.perplexedlabs.com/2008/02/06/mutex-with-php-and-mysql/' rel='bookmark' title='Permanent Link: Mutex with PHP and mySQL'>Mutex with PHP and mySQL</a></li>
<li><a href='http://blog.perplexedlabs.com/2008/02/04/php-simple-profiling-class/' rel='bookmark' title='Permanent Link: PHP Simple Profiling Class'>PHP Simple Profiling Class</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.perplexedlabs.com/2008/02/25/php-garbage-collection-and-memory-leaks/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
