php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20168 DOMXML - Memory Allocation Without Destroy
Submitted: 2002-10-30 04:44 UTC Modified: 2003-04-08 13:29 UTC
From: jury at elkor dot lv Assigned:
Status: Closed Package: DOM XML related
PHP Version: 4.2.3 OS: LINUX May be others
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jury at elkor dot lv
New email:
PHP Version: OS:

 

 [2002-10-30 04:44 UTC] jury at elkor dot lv
DOMXML Not free created document and php as static binary using as much memory as can. After usage of all memory kernel kill process

I'v not found any php_functions which is freeing XML Document. Except unset()

Example:

<?
while(1)
{
 $xml_doc = domxml_new_xmldoc("1.0");
 unset($xml_doc)
}
?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-30 07:11 UTC] chregu@php.net
There is no $dom->free() method at the moment. The DomObjects are only free at script-end. 

Programming such a method is on the todo list...

chregu
 [2003-04-08 13:29 UTC] chregu@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 [2003-06-04 13:01 UTC] rbro at hotmail dot com
Hi chregu,

I see a couple of months ago you added a $dom->free() method.  I'm running into the exact same problem except with a xpath object such as:

<?php
$xml = '<root><a></a></root>';
for ($i = 1; $i <= 50000; $i++)
{
	$dom = domxml_open_mem($xml);

	$xpath = xpath_new_context($dom);

	$dom->free();
}
?>

I added a bug about this in bug 24015 but it was marked as not a bug.  The xpath objects end up using up all my RAM (512 MB) and all my virtual memory because there is no way to free() the xpath object in the middle of the execution.  Would you be able to add a $xpath->free() function that's analogous to $dom->free()?  I currently have a CLI script trying to process several thousand different xml streams where I'm running into these memory problems.  Thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 27 20:01:32 2024 UTC