Php Memory Exhausted while memory_get_peak_usage says its inferior to memory_limit
I'm running through a memory issue. I'm generating a big PDF file of ~ 400 pages - ~1sec per page, with the TCPDF library.
When I first ran the script it failed (blank page). I increased the max_execution_time to be nb of page I need to process * 3 secs, so the execution time is no more an issue.
Then I repeatedly increased the memory_limit to 256M, 512M, 1024M and still have php memory exhausted fatal error.
When I开发者_运维百科 log the memory_get_peak_usage(true) and stop my process at 200 pages, I get a value of ~ 50M used.
I did some benchmarks then extrapolates memory consumption, and it should use ~ 80M to generate the whole PDF.
What do you guys think ? Is it possible that a memory leak happens sometimes late in the process and suddendly memory usage goes from 50M to > 1024M ? Or is there a bug in what memory_get_peak_usage(true) reports ? Is there a TCPDF memory leak ?
I also tried a few unsets on variables used throughout the pdf generation with no success.
Any clue well appreciated, I'm stuck with this :(
Thanks Julien
精彩评论