Forums / Developer / How to build an update CLI script without memory problem ? / Comment51107
Carlos Revillo
Monday 01 June 2009 11:49:10 am
Sorry, but this is not working for me. i just tried the next piece of code. it would be nice if anyone can do the same and tell everybody about the results
$nodes = eZContentObjectTreeNode::subTreeByNodeId( array("Limit" => 100) , 2 ); for ( $i = 0; $i < count( $nodes ); $i++ ) { $data = $nodes[$i]->dataMap(); echo memory_get_usage() . "<br />"; unset( $node ); unset( $GLOBALS['eZContentObjectContentObjectCache'] ); unset( $GLOBALS['eZContentObjectDataMapCache'] ); unset( $GLOBALS['eZContentObjectVersionCache'] ); }
As just see, i'm "unsetting" everything in each loop. but that call to echo memory_get_usage();shows something like
7211636 7214944 7237280 7268092 7328240 7373416 7390356 7457684 7500012 7516584 ...
Every time memory usage is increased. It's easy to think that if limit is big enough, memory will get exhausted...