#49711 [Opn->Bgs]: Memory Leak in Deprecated Methods ZEND_ACC_DEPRECATED
| From: | kristina at 10gen dot com | Date: | Tue, 06 Oct 2009 14:07:17 +0000 |
| Subject: | #49711 [Opn->Bgs]: Memory Leak in Deprecated Methods ZEND_ACC_DEPRECATED | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-143321@lists.php.net to get a copy of this message | ||
ID: 49711
User updated by: kristina at 10gen dot com
Reported By: kristina at 10gen dot com
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Windows
PHP Version: 5.3, 6 (2009-10-01)
New Comment:
Continued digging and found that PHPUnit is saving all the deprecated
warnings in an array. Sorry for the trouble.
Previous Comments:
------------------------------------------------------------------------
[2009-09-29 17:23:34] kristina at 10gen dot com
Okay, my bad. Fixed the extension. It prints:
3670016
10223616
(The first number is mem usage before running the function 10000 times,
the second the mem usage after).
------------------------------------------------------------------------
[2009-09-29 16:11:17] kristina at 10gen dot com
It segfaulted immediately, popping up the Visual Studio Just-In-Time
debugger window before outputting anything.
------------------------------------------------------------------------
[2009-09-29 15:14:32] jani@php.net
Please try using this snapshot:
http://snaps.php.net/php5.3-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
------------------------------------------------------------------------
[2009-09-29 14:49:57] kristina at 10gen dot com
Description:
------------
A method with the ZEND_ACC_DEPRECATED flag will cause memory usage to
increase each time it's called through PHPUnit. (It doesn't occur with
a PHP program run with "php script.php", so it might have something to
do with reflection.)
It occurs in 5.2.* and 5.3.*, only on Windows.
I've written a small PHP extension that demonstrates this bug. It is
available at http://github.com/beaddy1238/PHP-Memleak.
Reproduce code:
---------------
Compile the extension by putting the config.w32, php_mongo.h, and
mongo.c files in a pecl\mongo dir.
From the pecl\mongo directory, run:
phpunit tests\MongoRunner.php
It print out the memory used at the beginning and end of the function.
The function calls Mongo->lastError() (an empty method) 10000 times.
Expected result:
----------------
I expect the memory usage to stay the same.
Actual result:
--------------
The more times Mongo->lastError is called, the more memory is used.
This stops happening if ZEND_ACC_DEPRECATED is removed from mongo.c.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49711&edit=1