Mac OS X Leopard 10.5.8
PHP 5.2.12 (does not have recent memory management methods like gc_collect_cycles()
I have a large script for generating an offline version of a Drupal site with 1000s of nodes, which has to invoke node_load 1000s of times. Its seems to be causing memory usage problems (my diagnostics for it are a bit weak, because although I can get Xdebug loaded on my Mac I have not yet got it to interact properly with MacGDBp or Netbeans PHP), the memory usage grows until I hit the limit set in php.ini, as node after node is processed.
From node.module:
function node_load($param = array(), $revision = NULL, $reset = NULL) {
static $nodes = array();
if ($reset) {
$nodes = array();
}
I am calling node_load with $reset=true.
As far as I understand from references such as What’s better at freeing memory with PHP: unset() or $var = null, this should make the memory for the static cache available for collection, although it does not necessarily immediately trigger reclaiming.
Very glad for advice on how I can ensure that memory usage does not simply expand, which prevents my script (which may happily run for ours from the command line) from finishing. Also grateful for any tips on how I can diagnose memory usage.
I am using $node=null in my own methods outside node_load to likewise attempt to free up some mem.
Very glad for any advice on how I can ensure
Comments
Comment #1
webel commentedRelated: #375494: Restrict the number of nodes held in the node_load() static cache
Comment #2
kars-t commentedHi
I am closing this issue to clean up the issue queue. Feel free to reopen the issue if there is new information and the problem still resides. If not please make sure you close your issues that you don't need any more.
Maybe you can get support from the local user group. Please take a look at this list at groups.drupal.org.