Memory problem

Topics: Developer Forum, Project Management Forum, User Forum
Oct 1, 2008 at 10:25 PM
I am experience the following Fatal Error when I attempt to create more than 15 or 16 worksheets with about 75 rows and 10 columns of data.

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 19392 bytes) in path to PHPExcel/Calulation/FormulaParser.php on line 112
I originally thought this was happening because I was creating graphs (5 per worksheet) as images and inserting them in the worksheet, but I still get the error without any graphs

I hope there is a way to reduce the memory being used.

Developer
Oct 1, 2008 at 10:44 PM
Hmm... From the error message it looks like memory_limit has been set to 128M which is the usual default. Would it be possible for you to increase it? Example:

ini_set('memory_limit', '512M');

Oct 1, 2008 at 11:33 PM
Thanks again Koyama. I'll see what happens with more worksheets
Developer
Oct 1, 2008 at 11:43 PM
Tip to everyone:
You can check how much memory was used by the script by adding at the end of your PHP script:

// Echo memory peak usage
echo "Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB";


This way you can see if you are close to a memory exhaust.