Bug #64983 [Fbk->NoF]: Memory allocated to script doesn't reflect memory_limit configuration setting

From: Date: Sun, 14 Jun 2015 04:22:22 +0000
Subject: Bug #64983 [Fbk->NoF]: Memory allocated to script doesn't reflect memory_limit configuration setting
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-193441@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=64983&edit=1 ID: 64983 Updated by: php-bugs@lists.php.net Reported by: reallfqq-php at yahoo dot fr Summary: Memory allocated to script doesn't reflect memory_limit configuration setting -Status: Feedback +Status: No Feedback Type: Bug Package: FPM related Operating System: Debian 7 Wheezy PHP Version: 5.4.16 Assigned To: cmb Private report: N New Comment: No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Re-Opened". Thank you. Previous Comments: ------------------------------------------------------------------------ [2015-06-05 01:52:16] cmb@php.net Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. ------------------------------------------------------------------------ [2013-06-07 04:59:38] reallfqq-php at yahoo dot fr 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 this bug report at https://bugs.php.net/bug.php?id=64983&edit=1

« previous php.bugs (#193441) next »