I ran into this before, and implemented a workaround. <br><br>No amount of unset() would free memory. <br><br>The workaround was to ration the number of loop iterations to do via the script, and then end it and start a new one from where you left off.<br>
<br><span style="font-family: courier new,monospace;">while true</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">do</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;">  #php CLI or drush script goes here</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  NUM=$?</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">  TOTAL=`expr $TOTAL + $NUM`</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  if [ $NUM = 0 ]; then</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    break</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  fi</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">  sleep 30</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">done</span><br style="font-family: courier new,monospace;">
<br>The PHP CLI or drush script returns the number of nodes processed. If it is 0 then the script exits. If there are more, then another iteration is done.<br><br>This way, PHP&#39;s memory does not grow indefinitely and then bombs out eventually.<br>
<br><div class="gmail_quote">On Thu, Jul 15, 2010 at 9:04 AM, Ken Rickard <span dir="ltr">&lt;<a href="mailto:agentrickard@gmail.com">agentrickard@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Drush scripts (especially bulk node processing) are subject to hitting<br>
PHP memory limits when processing large amounts of data.<br>
<br>
Anyone have ways around that issue?<br>
<div><div></div><div class="h5"><br>
On Thu, Jul 15, 2010 at 8:49 AM, Moshe Weitzman &lt;<a href="mailto:weitzman@tejasa.com">weitzman@tejasa.com</a>&gt; wrote:<br>
&gt; I think drush scripts are your best bet. CLI PHP is not not subject to timeout.<br>
&gt;<br>
&gt; On Thu, Jul 15, 2010 at 5:01 AM, Sven Decabooter &lt;<a href="mailto:sdecabooter@gmail.com">sdecabooter@gmail.com</a>&gt; wrote:<br>
&gt;&gt; Hi,<br>
&gt;&gt; I&#39;m reading contradicting posts about running Batch API processes on cron.<br>
&gt;&gt; This is for Drupal 6 BTW.<br>
&gt;&gt; I have tried implementing a batch functionality that should be run on cron,<br>
&gt;&gt; but it doesn&#39;t seem to process the work that needs to be done.<br>
&gt;&gt; I assume this is because running the cron through a commandline command<br>
&gt;&gt; doesn&#39;t allow for javascript...<br>
&gt;&gt; So my questions:<br>
&gt;&gt; - Have I implemented Batch API incorrectly, and should it normally work also<br>
&gt;&gt; on cron?<br>
&gt;&gt; - What is the best way to run a process that would normally trigger a php<br>
&gt;&gt; script timeout? Can I use the Queue module for that?<br>
&gt;&gt; I&#39;m sure plenty of people have already tried doing this, so I&#39;m not sure why<br>
&gt;&gt; I can find little consistent information about it.<br>
&gt;&gt; Thanks for your feedback.<br>
&gt;&gt; Sven<br>
&gt;<br>
<br>
<br>
<br>
</div></div><font color="#888888">--<br>
Ken Rickard<br>
<a href="mailto:agentrickard@gmail.com">agentrickard@gmail.com</a><br>
<a href="http://ken.therickards.com" target="_blank">http://ken.therickards.com</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Khalid M. Baheyeldin<br><a href="http://2bits.com">2bits.com</a>, Inc.<br><a href="http://2bits.com">http://2bits.com</a><br>Drupal optimization, development, customization and consulting.<br>
Simplicity is prerequisite for reliability. --  Edsger W.Dijkstra<br>Simplicity is the ultimate sophistication. --   Leonardo da Vinci<br>