Fatal error: Allowed memory size

Oct 7, 2009 at 5:22 PM

I'm using a recent version.

Generating a spreadsheeting of 40 columns x 403 rows I'm getting

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 1572864 bytes) in /var/www/vhosts/top5000contacts.com/httpdocs/includes/phpexcel/Classes/PHPExcel/Style.php on line 745

This is only a test - the real one will have upto 2000 rows.

I've seen various other posts - is there a solution (works on my dev pc but not the external server)

 

Regards

Oct 7, 2009 at 5:37 PM

I've just taken out all the styling and I'm getting

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 96 bytes) in /var/www/vhosts/top5000contacts.com/httpdocs/includes/phpexcel/Classes/PHPExcel/Worksheet.php on line 936

How can it fail to allocate 96 bytes?

Regards

 

Coordinator
Oct 7, 2009 at 8:06 PM
Edited Oct 7, 2009 at 8:14 PM

With the latest code, we estimate memory usage at around an average of 1k/cell, and your memory limit is 32MB. That allows for about 32,000 cells (less the memory footprint of the script itself, about 7.25MB).

Note that the 06largescale.php script in the Tests directory generates a worksheet with 25000 cells, and uses a total of 41.25MB

Oct 7, 2009 at 9:52 PM

Thanks Mark

I hadn't realised the memory requirement and my dev pc was set to 128mb but the production server 32mb.  I've upped this to 64mb and the script now works.

Is the php memory setting per user or per server i.e what hapens if 2 users run the script simultaeneoulsy.


Regards

 

Coordinator
Oct 7, 2009 at 10:43 PM

Memory usage within PHP is per "thread"... while the request is being processed, the max available memory is for that thread (may include paged/swap memory, not necessarily physical memory). If you have 3 or even 4 concurrent threads being processed, most OS will swap to disk (if necessary) if there isn't sufficient physical memory in the server. Once the thread terminates, that memory is freed up again by the web server process.

 

Apr 17, 2010 at 1:11 AM

I was having the same problem but I have asigned 512MB of memory... after check I notice it was a circular reference that I have on the php code.

Remember: Double check all your formulas on excel first then check the php script.

 

Regards,

Coordinator
Apr 17, 2010 at 9:29 AM
tgp wrote:

after check I notice it was a circular reference that I have on the php code.

 :-)

Already ahead of you tgp. Current SVN already handles cyclic references in formulae, either by throwing an error or allowing a user-definable limit to the number of iterations before returning a result. This code will be included in release 1.7.3 (probably around the beginning of May), though you can access it now via the daily downloads.

There's also a number of changes being prepared for the 1.7.3 release that should reduce the overall memory requirements of PHPExcel.