Bug #53153 [Opn]: Memory leak with phpinfo() + output buffering + zlib compression
Edit report at http://bugs.php.net/bug.php?id=53153&edit=1
ID: 53153
Updated 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:
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.
Previous Comments:
------------------------------------------------------------------------
[2010-10-25 19:38:47] cataphract@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] 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
Thread (6 messages)