From: reallfqq-php at yahoo dot fr Operating system: Debian 7 Wheezy PHP version: 5.4.16 Package: FPM related Bug Type: Bug Bug description:Memory allocated to script doesn't reflect memory_limit configuration setting
Description: ------------ I am using a script retrieving distant content to local system using OAuth fetch function, thus copying the whole files into memory, before writing them to disk using file_put_contents. That means potentially big files end up in RAM. My script hangs up in the middle of the loop with a strange and important error: 'NOTICE: PHP message: PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 51366915 bytes)'. None of my files exceed thos 128MiB, by far. Using a loop to iterate through files, I started sending to stderr custom error messages to track PHP memory usage and eventually track down any memory leak. Using (in that specific order) the functions memory_get_usage(), memory_get_usage(true), memory_get_peak_usage() and memory_get_peak_usage(true), I got the following log (sample): NOTICE: PHP message: 18044352 (18350080) of 31360096 (32505856) I noticed the values returned by the peak_usage procedures were always the same, equal to 31MiB. Why is the max possible allocated memory for my script set to 31 MiB? The 'memory_limit' from PHP Info says 128M, confimed by the fatal error message. -- Edit bug report at https://bugs.php.net/bug.php?id=64983&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64983&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64983&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64983&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=64983&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=64983&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=64983&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=64983&r=needscript Try newer version: https://bugs.php.net/fix.php?id=64983&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=64983&r=support Expected behavior: https://bugs.php.net/fix.php?id=64983&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=64983&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=64983&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=64983&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64983&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=64983&r=dst IIS Stability: https://bugs.php.net/fix.php?id=64983&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=64983&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=64983&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=64983&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=64983&r=mysqlcfg