i have a memory problem in php. I have set the limit in php.ini to 512 M
the output of /var/log/apache2/error.log is:
PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 71 bytes) in /var/www/phpgraphlib.php on line 578,
the interesting piece of code is:
foreach ($saved_test_figurestoprint as $figuretoprint){
if (strpos($obj[$figuretoprint],",") >0 ){
$graphfilename= "graphfile".remove_invalid_chars_for_file($obj["_id"])."_".remove_invalid_chars_for_file($figuretoprint).".png" ;
$graph = new PHPGraphLib(1000,200,$graphfilename);
$data = explode(',', $obj[$figuretoprint]);
$graph->addData($data);
$graph->setTitle($figuretoprint);
$graph->setBars(false);
$graph->setLine(true);
$graph->setDataPoints(true);
$graph->setDataPointColor('maroon');
$graph->createGraph();
?> <td> <? echo $figuretoprint ; ?></td> <td> <?
echo <<<END
<imag src=$graphfilename>
END
?> </td></tr><tr><?
echo "</br></br>";
echo "used memory is ".memory_get_usage(true) . "\n";
the latest output is : used memory is 30408704
i am using a 64bit ubuntu and php 5.3. Linux mongo-db-server 2.6.35-28-generic #49-Ubuntu SMP Tue Mar 1 14:39:03 UTC 2011 x86_64 PHP Version 5.3.3-1ubuntu9.3 the problem arises if there are > 40 images to draw.
i think the new memory limit is not been applied to the server i have found this bug http://bugs.php.net/52061 but is only for memory limits > 2GB
can you help me ?