Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  PHP's Output Buffering

While profiling our application I came across a a rather strange memory usage by the ob_start() function. We do use ob_start() quite a bit to defer output of data, which is a common thing in many applications. What was unusual is that 16 calls to ob_start() up chewing through almost 700kb of memory, given that the data being buffered rarely exceeds 1-2kb, this was quite unusual.I started looking at the C code of the ob_start() function and found this interesting bit of code inside php_start_ob_buffer()initial_size = 40*1024;block_size = 10*1024;Which directs PHP to pre-allocate 40kb of data fo...

4,029 0       PHP MEMORY OB_START() SOURCE 40KB