From:             luka8088 at gmail dot com
Operating system: Windows
PHP version:      5.2.5
PHP Bug Type:     *XML functions
Bug description:  xml_set_object memory leak

Description:
------------
xml_set_object causes memory leak....

in example, an infinite loop i written which should not constantly
increase memory...

When xml_set_object($this->parser, &$this); is removed, memory leak
stops...

Reproduce code:
---------------
class xml
        {
        function __construct()
                {
                $this->parser = xml_parser_create();
                xml_set_object($this->parser, &$this);
                }
        
        function __destruct()
                {
                xml_parser_free($this->parser);
                }
        }

while (true)
        {
        usleep(1000);
        $x = new xml();
        unset($x);
        }

Expected result:
----------------
Nothing should happen ....

Actual result:
--------------
when below code is run.. memory usage increases 5 MB/s for abount 15
seconds and then:

PHP Fatal error:  Allowed memory size of 16777216 bytes exhausted (tried
to allocate 16 bytes) in D:\source\php\include\xml.php on line 18
Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to
allocate
16 bytes) in D:\source\php\include\xml.php on line 18

-- 
Edit bug report at http://bugs.php.net/?id=44810&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=44810&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=44810&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=44810&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=44810&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=44810&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=44810&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=44810&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=44810&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=44810&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=44810&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=44810&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=44810&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=44810&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=44810&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=44810&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=44810&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=44810&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=44810&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=44810&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=44810&r=mysqlcfg

Reply via email to