Bug #53153 [Com]: Memory leak with phpinfo() + output buffering + zlib compression

From: Date: Mon, 25 Oct 2010 17:38:47 +0000
Subject: Bug #53153 [Com]: Memory leak with phpinfo() + output buffering + zlib compression
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-155505@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=53153&edit=1 ID: 53153 Comment by: cataphract@php.net Reported by: cataphract@php.net Summary: Memory leak with phpinfo() + output buffering + zlib compression Status: Open Type: Bug Package: Output Control Operating System: Windows 7 x64 PHP Version: trunk-SVN-2010-10-25 (SVN) Block user comment: N New Comment: Note: there seems to be no leak if the environment variables HTTP_ACCEPT_ENCODING actually triggers the zlib compression. Previous Comments: ------------------------------------------------------------------------ [2010-10-25 19:26:56] cataphract@php.net Interestingly there's also some corrupted/uninitialized memory in the memory leak message: </div></body></html>[Mon Oct 25 18:19:39 2010] Script: 'ZZZZZZZZZ8↔▄¥▄¥¥?d╔Ï@Ç ☺' c:\users\cataphract\documents\php-src\main\output.c(809) : Freeing 0x012B0088 ( 49152 bytes), script=ZZZZZZZZZ8↔▄¥▄¥¥?d╔Ï@Ç☺ === Total 1 memory leaks detected === ------------------------------------------------------------------------ [2010-10-25 19:25:44] cataphract@php.net Description: ------------ There is a memory leak on memory allocated on \main\output.c(809): if ((handler->buffer.size - handler->buffer.used) <= buf->used) { size_t grow_int = PHP_OUTPUT_HANDLER_INITBUF_SIZE(handler->size); size_t grow_buf = PHP_OUTPUT_HANDLER_INITBUF_SIZE(buf->used - (handler->buffer.size - handler->buffer.used)); size_t grow_max = MAX(grow_int, grow_buf); handler->buffer.data = erealloc(handler->buffer.data, handler->buffer.size + grow_max); /* memory was allocated here */ handler->buffer.size += grow_max; } phpinfo() code: /* Andale! Andale! Yee-Hah! */ php_output_start_default(TSRMLS_C); php_print_info(flag TSRMLS_CC); php_output_end(TSRMLS_C); Test script: --------------- File file.php --- <?php phpinfo(); (only the non disablable modules are loaded) php-cgi -dzlib.output_compression=1 -doutput_buffering=10K file.php ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=53153&edit=1

« previous php.bugs (#155505) next »