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'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"><<a href="mailto:agentrickard@gmail.com">agentrickard@gmail.com</a>></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 <<a href="mailto:weitzman@tejasa.com">weitzman@tejasa.com</a>> wrote:<br>
> I think drush scripts are your best bet. CLI PHP is not not subject to timeout.<br>
><br>
> On Thu, Jul 15, 2010 at 5:01 AM, Sven Decabooter <<a href="mailto:sdecabooter@gmail.com">sdecabooter@gmail.com</a>> wrote:<br>
>> Hi,<br>
>> I'm reading contradicting posts about running Batch API processes on cron.<br>
>> This is for Drupal 6 BTW.<br>
>> I have tried implementing a batch functionality that should be run on cron,<br>
>> but it doesn't seem to process the work that needs to be done.<br>
>> I assume this is because running the cron through a commandline command<br>
>> doesn't allow for javascript...<br>
>> So my questions:<br>
>> - Have I implemented Batch API incorrectly, and should it normally work also<br>
>> on cron?<br>
>> - What is the best way to run a process that would normally trigger a php<br>
>> script timeout? Can I use the Queue module for that?<br>
>> I'm sure plenty of people have already tried doing this, so I'm not sure why<br>
>> I can find little consistent information about it.<br>
>> Thanks for your feedback.<br>
>> Sven<br>
><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>