Menu

Fatal error: Allowed memory size

Help
al caughey
2009-02-19
2012-10-09
  • al caughey

    al caughey - 2009-02-19

    I'm looking at using pchart to dynamically build graphs into a web app and then include the chart in a PDF... hopefully via writeHTML() rather than Image()

    I thought I'd streamline the effort by simply modifying Example006.php and replacing the img src with an image from the pchart site (specifically, 'http//pchart.sourceforge.net/Pictures/example10.png')

    Somewhat unexpectedly, I get the following message:
    Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 1570599827 bytes) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\tcpdf\tcpdf.php on line 4238

    The image is not that large... 380px × 200px, 12.7 KB (13009 bytes)

    (In other PDF exercises, I've successfully included an image that was 170KB... so why the error on this image?!?)

    Any thoughts?

    TIA

    Al

     
    • Brian Morris

      Brian Morris - 2009-07-26

      This issue still occurs on 4.6.022.

      Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 529782 bytes) in /var/www/Development/ibsv3_caa/system/application/thirdparty/tcpdf/tcpdf.php on line 4795

       
      • Nicola Asuni

        Nicola Asuni - 2009-07-27

        Probably this is caused by some internal loop due to a remote security restriction.
        Please try to debug it a little bit to find out where the problem is.

         
    • Nicola Asuni

      Nicola Asuni - 2009-02-24

      The latest TCPDF release contains some memory optimizations.

       
    • okaalto

      okaalto - 2009-03-13

      I got the very same problem using Google Chart API to generate PNG image for charts (tcpdf 4.5.026):

      PHP Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to
      allocate 1589475898 bytes) in tcpdf.php on line 4454

      I tracked to error to fread() call in function _parsepng($file). The fread is called with either very large values or with negative values which shows that there's error somewhere reading PNG data streamed from network.

      I tried to post bug report on this, but unfortunately it was closed.

       
    • okaalto

      okaalto - 2009-03-16

      I made some more testing, and it seems that the implementation of function _parsepng($file) does not support very well the case when the image file data is streamed from network. More specifically, the way the image data is read (i.e. reading and parsing PNG data in same loop) works ok with local files in the filesystem, but not always when the data comes from the network. See e.g. example #3 in http://fi.php.net/fread

      I think this is obvious bug, since anything shouldn't crash with fatal error, really, and not because feeding fread with stale parameters. I have no suggestion how to fix this properly, reading remote images to a local temp file first before parsing would definitely work. A better solution would be some kind a rewrite to the image data reading & parsing loop.

       
      • Nicola Asuni

        Nicola Asuni - 2009-03-16

        OK, I've fixed this on TCPDF 4.5.027.

         
        • subhashree rout

          subhashree rout - 2009-04-20

          Table format is also not coming. If any colspan is present in html structure then Division by 0 error is coming.

           
    • Kai Schätzl

      Kai Schätzl - 2009-07-26

      Does it go away when you up the memory limit?

       
    • Brian Morris

      Brian Morris - 2009-07-26

      Negative. However, it still looks like that PNG remote image deal.

       
    • Kai Schätzl

      Kai Schätzl - 2009-07-26

      Maybe so. But to what value did you increase it?

       
    • Brian Morris

      Brian Morris - 2009-07-26

      2GB. But there should be no reason in the world a simple 600kb graphic would do this. Not to mention that when i do the image locally, it works fine. Only when the image is remote does this problem occur.

       

Log in to post a comment.

Auth0 Logo