Quantcast
Channel: Issues for XML sitemap
Viewing all articles
Browse latest Browse all 1238

Static caching causes excessive memory use when bulk creating/updating nodes

$
0
0

xmlsitemap_node_get_timestamps() maintains a static list of timestamps for every node it has seen in the current request:

<?php
 
static $timestamps = array();
  if (!isset(
$timestamps[$node->nid])) {
...
?>

When creating thousands of nodes in a process (say, hypothetically;), when migrating), that can add up. Using drupal_static() for this static cache at least presents the opportunity to recover the memory. The Migrate module does this when it senses memory_limit is drawing near, and generally recovers plenty to continue as long as no hooks are using local statics like this.


Viewing all articles
Browse latest Browse all 1238