<?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>My Beloved PHP &#187; Uncategorized</title>
	<atom:link href="http://www.mybelovedphp.com/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mybelovedphp.com</link>
	<description>The Art of Quick &#38; Dirty Programming</description>
	<lastBuildDate>Sun, 06 Jun 2010 21:08:36 +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 memory leak</title>
		<link>http://www.mybelovedphp.com/2007/11/28/php-memory-leak/</link>
		<comments>http://www.mybelovedphp.com/2007/11/28/php-memory-leak/#comments</comments>
		<pubDate>Wed, 28 Nov 2007 18:39:22 +0000</pubDate>
		<dc:creator>programmer</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.mybelovedphp.com/2007/11/28/php-memory-leak/</guid>
		<description><![CDATA[Consider an RSS feed read in as an SimpleXMLobject $rss. What&#8217;s the difference between: foreach ($rss-&#62;channel as $channel) { ... } and $foo = $rss-&#62;channel; foreach ($foo as $channel) { ... } Not much you would say, the first code example is shorter and more to the point. However when putting the scripts to work, [...]]]></description>
			<content:encoded><![CDATA[<p>Consider an RSS feed read in as an SimpleXMLobject $rss.</p>
<p>What&#8217;s the difference between:</p>
<p><code>foreach ($rss-&gt;channel as $channel) {<br />
...<br />
}</code></p>
<p>and<br />
<code> $foo = $rss-&gt;channel;<br />
foreach ($foo as $channel) {<br />
...<br />
}</code></p>
<p>Not much you would say, the first code example is shorter and more to the point. However when putting the scripts to work, (with a big rss file) we&#8217;ll soon see the difference.</p>
<h5>Memory problem and a growing swap file</h5>
<p>After a while the former example is causing a lot of disk activity and you will see your swap file grow and grow, at my computer it reached the maximum of 4 GB and off course it took ages for the script to finish.</p>
<p>And all that while the maximum memory usage for a script is set to 24MB in php.ini. Should run in a 1G computer you would say.<br />
WellÂ example 2 does but example 1 does not!</p>
<p>Is seems that iterating over an object-property in a foreach loop is troubled by a memory leak.</p>
<h5>Solution</h5>
<p>Example 2 is the workaround!</p>
<h5>Conclusion</h5>
<p>PHP 5.1 until 5.2 seem to suffer from this memory leak.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mybelovedphp.com/2007/11/28/php-memory-leak/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Technorati Post</title>
		<link>http://www.mybelovedphp.com/2006/12/20/technorati-post/</link>
		<comments>http://www.mybelovedphp.com/2006/12/20/technorati-post/#comments</comments>
		<pubDate>Wed, 20 Dec 2006 00:04:10 +0000</pubDate>
		<dc:creator>programmer</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.mybelovedphp.com/archives/9</guid>
		<description><![CDATA[Technorati Profile No further use.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.technorati.com/claim/2jrx5kbh9" rel="me">Technorati Profile</a><br />
No further use. <img src='http://www.mybelovedphp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.mybelovedphp.com/2006/12/20/technorati-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
