Edit report at http://bugs.php.net/bug.php?id=53153&edit=1
ID: 53153 Updated by: cataphr...@php.net Reported by: cataphr...@php.net Summary: Memory leak with phpinfo() + output buffering + zlib compression -Status: Assigned +Status: Closed Type: Bug Package: Output Control Operating System: Windows 7 x64 PHP Version: trunk-SVN-2010-10-25 (SVN) -Assigned To: mike +Assigned To: cataphract Block user comment: N Previous Comments: ------------------------------------------------------------------------ [2010-11-02 04:49:50] cataphr...@php.net Automatic comment from SVN on behalf of cataphract Revision: http://svn.php.net/viewvc/?view=revision&revision=305022 Log: - Fixed bug #53153 (memory leak with phpinfo() + output buffering + zlib compression). ------------------------------------------------------------------------ [2010-11-01 23:04:00] cataphr...@php.net Adding a line in output.c:810: handler->buffer.data = erealloc(handler->buffer.data, handler->buffer.size + grow_max); fprintf(stderr, "%X: %d\n", handler->buffer.data, php_output_get_level(TSRMLS_C)); handler->buffer.size += grow_max; D55368: 3 D62748: 3 D70088: 2 D7C0C0: 2 [Mon Nov 01 21:58:47 2010] Script: 'zzzzzzzzzdö`â¼`â¼â¼Â¬Â½Ã�...@Ãâº' c:\users\cataphract\documents\php-src\main\output.c(809) : Freeing 0x00D70088 ( 49152 bytes), script=zzzzzzzzzdö`â¼`â¼â¼Â¬Â½Ã�...@Ã⺠At level 2 it's the zlib handler. ------------------------------------------------------------------------ [2010-10-25 19:38:47] cataphr...@php.net Note: there seems to be no leak if the environment variables HTTP_ACCEPT_ENCODING actually triggers the zlib compression. ------------------------------------------------------------------------ [2010-10-25 19:26:56] cataphr...@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] cataphr...@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