ID:               41452
 Updated by:       [EMAIL PROTECTED]
 Reported By:      mike at netagi dot com
-Status:           Open
+Status:           Wont fix
 Bug Type:         DOM XML related
 Operating System: Ubuntu Linux 6.06 LTS
 PHP Version:      4.4.7
 New Comment:

You need to upgrade to PHP 5 and ext/DOM.
This is just one of the reasons for the re-write of ext/domxml. Unset()
and variable scope have no effect on the structures created by
ext/domxml and they are not freed until the request is completed.


Previous Comments:
------------------------------------------------------------------------

[2007-05-21 06:45:25] mike at netagi dot com

Description:
------------
Directly after calling node->first_child the memory usage increases and
does not drop. This might also be the case with has_child_nodes.

I've tried numerous test cases (as I am trying to keep memory
consumption low) but have had no luck. I've tried using functions so the
variables lose scope etc. Whatever gets created during the first_child
can never be freed.

I understand that the Zend Engine may be caching some structures,
however i have allocated 120 Meg to PHP4 CLI and it's still returning an
out of memory error. If I disable first_child the script runs without
any issues.



Reproduce code:
---------------
$doc = domxml_open_file("import_prod_cat.xml");
$xpath = $doc->xpath_new_context();
$obj = $xpath->xpath_eval('//import_catprod_link');
$nodeset = $obj->nodeset;
foreach($nodeset as $node ) {
        print "S1 " . memory_get_usage() . "\n";
        if( $node->has_child_nodes() ) {
                print " S2 " . memory_get_usage() . "\n";
                $child = $node->first_child();
                print " S3 " . memory_get_usage() . "\n";
                unset($child);
                unset($node);
                print " S4 " . memory_get_usage() . "\n";
        }
        print " S6 " . memory_get_usage() . "\n";
}
$doc->free();

Actual result:
--------------
S1 21202968
 S2 21203040
 S3 21204416
 S4 21204456
 S5 21204456

S1 21204456
 S2 21204456
 S3 21205184
 S4 21205224
 S5 21205224

S1 21205224
 S2 21205224
 S3 21205952
 S4 21205992
 S5 21205992

S1 21205992
 S2 21205992
 S3 21206720
 S4 21206760
 S5 21206760

... etc until it runs out of ram.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=41452&edit=1

Reply via email to