I'm getting a fatal memory error and have been unable to figure out what is causing it. To make it worse, the allowed memory size does not appear to be related in any way to the memory_limit value. Here's the information:
Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 128 bytes) in template.php on line 164
Excerpt from template.php (line 164 is where $max is assigned):
...
Code: Select all
else if(isDateType($type) || isTimestampType($type) || isDatetimeType($type))
{
$min = htmlentities($countpost['constraints'][$tablename][$fieldname]['min'], ENT_QUOTES);
$max = htmlentities($countpost['constraints'][$tablename][$fieldname]['max'], ENT_QUOTES);
echo "\t\tFrom: <input name=\"constraints[$tablename][$fieldname][min]\""
." type=text value=\"$min\" onclickXSSCleaned=\"toggleCalendar(this)\" readonly>\n";
echo "\t\tTo: <input name=\"constraints[$tablename][$fieldname][max]\""
." type=text value=\"$max\" onclickXSSCleaned=\"toggleCalendar(this)\" readonly>\n";
}These two lines were included at the top of the script and printed "Base Memory Usage: 473172 Memory Limit: -1":
echo "Base Memory Usage: ". memory_get_usage() ."\n";
echo "Memory Limit: ". ini_get('memory_limit') ."\n";
I also get the same error in a slightly different location:
Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 1 bytes) in template.php on line 153
Excerpt from template.php (line 153 is the simple variable assignment of an empty string):
...
Code: Select all
if(!isset($countpost['constraints'][$tablename][$fieldname]['value']))
$countpost['constraints'][$tablename][$fieldname]['value'] = "";If I refresh the page repeatedly, the error will predictably occur at the same place. Once I change any code (even slightly), the location of the error will change to a new location, sometimes into an included file. The size of "tried to allocate X bytes" also changes. The only constant in this whole mess is the allowed memory size (which is ALWAYS 262144, no matter what the actual memory limit is).
I had previously set memory_limit to -1 in the php.ini file, which seems to have no effect on the error. I am not using a .htaccess file. Changing the memory_limit doesn't change the "allowed memory size" whether it's set to -1, 16M, or whatever.
This is using php 5.3.2, apache2 2.2.14, on Ubuntu 10.04. Any insights would be greatly appreciated.
Pat
pickle | Please use [ syntax=php ], [ syntax=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: