On Tue, May 1, 2012 at 8:44 PM, Paul Reinheimer <preinhei...@gmail.com> wrote:
> Hi,
>
>> It sounds like it.  In that case the memory spike is happening in the output
>> buffer, where the file is streamed into by readfile() in 8K chunks until the
>> output buffer explodes. :-)
>>
>> So, I think we're back to "urban legend" territory.
>
>
> That's good to know. Thanks, and my apologies for adding confusion to the 
> issue.
>
> One question, with a value of 4096 for the ini directive, shouldn't it
> be flushing data to the client long before I run into memory issues?
> What have I missed here.
>

That's an interesting catch, and the answer is here
:http://lxr.php.net/opengrok/xref/PHP_5_3/main/output.c#596
In fact, even if your ob layer is , say , 4K length, PHP will
reallocate it to fit the data written in it
(http://lxr.php.net/opengrok/xref/PHP_5_3/main/output.c#395) with a
block_size step
(http://lxr.php.net/opengrok/xref/PHP_5_3/main/output.c#402)

In short, having an output_buffer of, say, 4K lenght, will not prevent
PHP to allocate several Mb of data if the OB layer gets suddenly fed
with such amount of data, what readfile() with MMAP strategy does
actually.

Mike could help as he's the main ob layer designer.

Bye :)

Julien.Pauli

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to