Re: Using 'header' as redirect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Philip Thompson wrote:
I was under the impression that if ob_end_flush() was not called, then there would be a memory leak. Is this not the case?

No, it's not. All output buffers are flushed in the reverse order of opening when the script ends.

From http://us3.php.net/ob_start :

"Output buffers are stackable, that is, you may call ob_start() while another ob_start() is active. Just make sure that you call ob_end_flush() the appropriate number of times. If multiple output callback functions are active, output is being filtered sequentially through each of them in nesting order."

I'm not sure why the manual says this. As far as I know there is no need to balance opens and closes, except that it's good practice to keep track of them if you're opening more than one buffer.

Also 4096k... I wonder if that's enough buffering to include all the stuff that I want to show? As of right now, it is. Is there another standard level of buffering to specify?


The buffering limit is not a hard limit. When the buffer gets full it is implicitly flushed after which buffering starts again. In your case you are only buffering to allow for headers to be output after HTML output has been started, so as long as you do so before this number of bytes have been output you'll be ok. As far as "standard level"s go, you can use any number in that field but bear in mind that the buffer will likely be allocated to this size so you'll want to keep it reasonably low.

Also, I think you'll find that's bytes, not kilobytes.

-Stut

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux