There's good discussion about different ways to change the PHP memory limit in the article Fatal error: Allowed memory size of X bytes exhausted (tried to allocate Y bytes)...
On my local stack, one relevant file is /etc/php5/apache2/php.ini which had a limit of 512M that I had set about two years ago. That seemed like a lot already. I upped it to 640M, but got the same error at exactly the same line of code.
So I fired up a debugger to trace through. When execution reached the loop body containing the reported line where execution died (line 4 below), I single-stepped, single-stepped, single-stepped, ... and it didn't leave after the expected number of iterations.
1: $dirname = pathinfo($current_path, PATHINFO_DIRNAME);Line 3 kept adding entries to the $page array until memory was exhausted. It was my own coding mistake in inadvertently creating a runaway infinite loop.
2: while ($dirname && $dirname != '.') {
3: $page['#cache']['tags'][] = 'optimizely:' . $dirname . '/*';
4: $dirname = pathinfo($dirname, PATHINFO_DIRNAME);
5: }
∞
Sources:
Fatal error: Allowed memory size of X bytes exhausted (tried to allocate Y bytes)...
https://www.drupal.org/node/76156
No comments:
Post a Comment