<?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>Autarchy of the Private Cave &#187; memory</title> <atom:link href="https://bogdan.org.ua/tags/memory/feed" rel="self" type="application/rss+xml" /><link>https://bogdan.org.ua</link> <description>Tiny bits of bioinformatics, [web-]programming etc</description> <lastBuildDate>Wed, 28 Dec 2022 16:09:04 +0000</lastBuildDate> <language>en-US</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>https://wordpress.org/?v=3.8.27</generator> <item><title>Bad memory handling and server stability</title><link>https://bogdan.org.ua/2009/07/13/bad-memory-handling-and-server-stability.html</link> <comments>https://bogdan.org.ua/2009/07/13/bad-memory-handling-and-server-stability.html#comments</comments> <pubDate>Mon, 13 Jul 2009 09:29:27 +0000</pubDate> <dc:creator><![CDATA[Bogdan]]></dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[memory]]></category> <category><![CDATA[mtrace]]></category> <category><![CDATA[RAM]]></category> <category><![CDATA[valgrind]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=813</guid> <description><![CDATA[The two graphs below (clickable) are for CPU and RAM use during a period of a program going wild between 23:17 and 23:41 (24+ minutes of server&#8217;s downtime). The program was run non-root, it just consumed all the memory it could. It was killed by kernel, so the server started responding without any interventions &#8211; [&#8230;]]]></description> <content:encoded><![CDATA[<p>The two graphs below (clickable) are for CPU and RAM use during a period of a program going wild between 23:17 and 23:41 (24+ minutes of server&#8217;s downtime). The program was run non-root, it just consumed all the memory it could. It was killed by kernel, so the server started responding without any interventions &#8211; which were hard to perform, because none of the services (including ssh) were responding during downtime.<br
/> <a
href="http://bogdan.org.ua/wp-content/uploads/2009/07/cpugraph.png"><img
src="http://bogdan.org.ua/wp-content/uploads/2009/07/cpugraph-500x130.png" alt="cpugraph" title="cpugraph" width="500" height="130" class="aligncenter size-medium wp-image-814" /></a><br
/> <a
href="http://bogdan.org.ua/wp-content/uploads/2009/07/memgraph.png"><img
src="http://bogdan.org.ua/wp-content/uploads/2009/07/memgraph-500x138.png" alt="memgraph" title="memgraph" width="500" height="138" class="aligncenter size-medium wp-image-815" /></a></p><p>If you happen to be developing a C/C++ program &#8211; do use mtrace and valgrind, those are huge helpers against the problems akin to that shown on the graphs.</p><p><a
class="a2a_button_citeulike" href="https://www.addtoany.com/add_to/citeulike?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2009%2F07%2F13%2Fbad-memory-handling-and-server-stability.html&amp;linkname=Bad%20memory%20handling%20and%20server%20stability" title="CiteULike" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2009%2F07%2F13%2Fbad-memory-handling-and-server-stability.html&amp;linkname=Bad%20memory%20handling%20and%20server%20stability" title="Pocket" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2009%2F07%2F13%2Fbad-memory-handling-and-server-stability.html&amp;linkname=Bad%20memory%20handling%20and%20server%20stability" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2009%2F07%2F13%2Fbad-memory-handling-and-server-stability.html&amp;linkname=Bad%20memory%20handling%20and%20server%20stability" title="Evernote" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2009%2F07%2F13%2Fbad-memory-handling-and-server-stability.html&amp;linkname=Bad%20memory%20handling%20and%20server%20stability" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a
class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fbogdan.org.ua%2F2009%2F07%2F13%2Fbad-memory-handling-and-server-stability.html&#038;title=Bad%20memory%20handling%20and%20server%20stability" data-a2a-url="https://bogdan.org.ua/2009/07/13/bad-memory-handling-and-server-stability.html" data-a2a-title="Bad memory handling and server stability"><img
src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded> <wfw:commentRss>https://bogdan.org.ua/2009/07/13/bad-memory-handling-and-server-stability.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Avoiding out of memory fatal error when using HTTP_Client or HTTP_Request</title><link>https://bogdan.org.ua/2006/09/06/avoiding-out-of-memory-fatal-error-when-using-http_client-or-http_request.html</link> <comments>https://bogdan.org.ua/2006/09/06/avoiding-out-of-memory-fatal-error-when-using-http_client-or-http_request.html#comments</comments> <pubDate>Wed, 06 Sep 2006 08:58:29 +0000</pubDate> <dc:creator><![CDATA[Bogdan]]></dc:creator> <category><![CDATA[Bioinformatics]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[Science]]></category> <category><![CDATA[http]]></category> <category><![CDATA[HTTP_Client]]></category> <category><![CDATA[HTTP_Request]]></category> <category><![CDATA[memory]]></category> <guid
isPermaLink="false">http://www.bogdan.org.ua/2006/09/06/avoiding-out-of-memory-fatal-error-when-using-http_client-or-http_request.html</guid> <description><![CDATA[If you fetch large amounts of data (e.g. over 2MB per request) using HTTP_Client (or HTTP_request), you may get &#8220;out of memory&#8221; fatal errors, especially if: memory_limit is set to default 8M, and you process multiple pages using single non-reset instance of HTTP_Client object. This problem can manifest itself by producing fatal error after a [&#8230;]]]></description> <content:encoded><![CDATA[<p>If you fetch large amounts of data (e.g. over 2MB per request) using HTTP_Client (or HTTP_request), you may get &#8220;out of memory&#8221; fatal errors, especially if:</p><ol><li>memory_limit is set to default 8M, and</li><li>you process multiple pages using single non-reset instance of HTTP_Client object.</li></ol><p>This problem can manifest itself by producing fatal error after a couple of cycles of successful page retrieval &#8211; but always, if run with the same parameters, after some constant or only slightly variable number of cycles.</p><p>In my case the problem was that HTTP_Request (a dependancy of HTTP_Client) was holding in memory all the previously fetched pages of the current session (the &#8216;history&#8217; feature). To force HTTP_Request to hold only the most recent page, you need to &#8216;disable&#8217; history after creating the HTTP_Client or HTTP_Request object instance:</p><div
id="ig-sh-1" class="syntax_hilite"><div
class="code"><ol
class="php" style="font-family:monospace;"><li
style="font-weight: normal; vertical-align:top;"><div
style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">$req = &amp;new HTTP_Client($params, $headers);</div></li><li
style="font-weight: normal; vertical-align:top;"><div
style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">// disable history to save memory</div></li><li
style="font-weight: normal; vertical-align:top;"><div
style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">$req-&gt;enableHistory(false);</div></li></ol></div></div><p>Hope this helps you.</p><p><a
class="a2a_button_citeulike" href="https://www.addtoany.com/add_to/citeulike?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2006%2F09%2F06%2Favoiding-out-of-memory-fatal-error-when-using-http_client-or-http_request.html&amp;linkname=Avoiding%20out%20of%20memory%20fatal%20error%20when%20using%20HTTP_Client%20or%20HTTP_Request" title="CiteULike" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2006%2F09%2F06%2Favoiding-out-of-memory-fatal-error-when-using-http_client-or-http_request.html&amp;linkname=Avoiding%20out%20of%20memory%20fatal%20error%20when%20using%20HTTP_Client%20or%20HTTP_Request" title="Pocket" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2006%2F09%2F06%2Favoiding-out-of-memory-fatal-error-when-using-http_client-or-http_request.html&amp;linkname=Avoiding%20out%20of%20memory%20fatal%20error%20when%20using%20HTTP_Client%20or%20HTTP_Request" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2006%2F09%2F06%2Favoiding-out-of-memory-fatal-error-when-using-http_client-or-http_request.html&amp;linkname=Avoiding%20out%20of%20memory%20fatal%20error%20when%20using%20HTTP_Client%20or%20HTTP_Request" title="Evernote" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2006%2F09%2F06%2Favoiding-out-of-memory-fatal-error-when-using-http_client-or-http_request.html&amp;linkname=Avoiding%20out%20of%20memory%20fatal%20error%20when%20using%20HTTP_Client%20or%20HTTP_Request" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a
class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fbogdan.org.ua%2F2006%2F09%2F06%2Favoiding-out-of-memory-fatal-error-when-using-http_client-or-http_request.html&#038;title=Avoiding%20out%20of%20memory%20fatal%20error%20when%20using%20HTTP_Client%20or%20HTTP_Request" data-a2a-url="https://bogdan.org.ua/2006/09/06/avoiding-out-of-memory-fatal-error-when-using-http_client-or-http_request.html" data-a2a-title="Avoiding out of memory fatal error when using HTTP_Client or HTTP_Request"><img
src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded> <wfw:commentRss>https://bogdan.org.ua/2006/09/06/avoiding-out-of-memory-fatal-error-when-using-http_client-or-http_request.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>