Re: cvs: php-src(PHP_5_3) /ext/openssl xp_ssl.c /ext/standard file.c http_fopen_wrapper.c streamsfuncs.c /main/streams streams.c userspace.c
xp_socket.c
| From: | Antony Dovgal | Date: | Fri, 11 Jul 2008 12:42:58 +0000 |
| Subject: | Re: cvs: php-src(PHP_5_3) /ext/openssl xp_ssl.c /ext/standard file.c http_fopen_wrapper.c streamsfuncs.c /main/streams streams.c userspace.c xp_socket.c |
||
| References: | 1 2 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-51009@lists.php.net to get a copy of this message | ||
On 11.07.2008 15:04, Pierre Joye wrote:
Hi Tony, News? btw, is it testable?Yes, you can reproduce it using this script: <?php for ($i = 0; $i < 100; $i++) { $context = $opts = array(
'http'=>array(
'method'=>"GET" /* whatever */
)
);
$context = stream_context_create($opts);
$fp = fopen(dirname(__FILE__)."/test.php", "r", false, $context);
fclose($fp);
unset($context); /* after that refcount should be 0 and free() should be called */
var_dump(memory_get_usage()); /* you should not see memory usage increasing */
}
?>
Without the patch, you shall see constant growth of memory usage, even though all variables are destroyed.
This happens because stream contexts are (i.e. were) freed only on shutdown.
--
Wbr,
Antony Dovgal