php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29450 massive memmory problem in domxml_open_mem
Submitted: 2004-07-29 22:02 UTC Modified: 2004-07-30 17:41 UTC
From: bo at theaddedones dot com Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 4.3.8 OS: MAC OS X, AMD Altholon, SOLARIS
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bo at theaddedones dot com
New email:
PHP Version: OS:

 

 [2004-07-29 22:02 UTC] bo at theaddedones dot com
Description:
------------
I know this issue has been resolved in PHP 5.0 using DomDocument::loadXML, BUT in non 5.0 versions, the loading of  string XML (memmory) bits has some serious garbage collection problems...namely repeated calls to domxml_open_mem eats the memmory of the system alive....

unsetting variables has no effect....

Reproduce code:
---------------
$tt  = '<?xml version="1.0" encoding="ISO-8859-1"?>
<data>
        <ff>
                <rrr>555</rrr>
                <rrrr>5555</rrrr>
                <rrrrr>55555</rrrrr>
                <rrrrrr>555555</rrrrrr>
                <rrrrrrr>5555555</rrrrrrr>
                <rrrrrrrr>55555555</rrrrrrrr>
                <rrrrrrrrr>555555555</rrrrrrrrr>
        </ff>
</data>'; 
for($i=0;$i<100000;$i++){
	$dd  = domxml_open_mem($tt);
	unset($dd);
}	

Expected result:
----------------
not to have the system memory jump by Megabytes...if the loop is left for longer it will eventually chew all resources

Actual result:
--------------
massive eating of memmory

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-29 22:09 UTC] bo at theaddedones dot com
forgot to include the config bits for the system...

System => Linux pict2.pictopia.com 2.6.6-1.435.2.3smp #1 SMP Thu Jul 1 08:51:38 EDT 2004 x86_64
Build Date => Jul  1 2004 15:03:35
Configure Command =>  './configure' '--enable-mbstring=all' '--enable-bcmath' '--enable-calender' '--enable-mailparse' '--enable-shmop' '--enable-shared' '--enable-sysvsem' '--with-gettext=/export/home/imgdb' '--with-mysql=/export/home/imgdb/mysql' '--with-mysql-sock=/export/home/imgdb/mysql/locks/mysql.sock' '--with-curl=/export/home/imgdb/' '--enable-exif' '--enable-ftp' '--enable-mbstring' '--with-openssl=/export/home/imgdb' '--enable-mbregex' '--enable-session' '--enable-sockets' '--enable-tokenizer' '--enable-wddx' '--with-xml' '--enable-trans-id' '--enable-track-vars' '--with-imap=/export/home/imgdb/imap-2004' '--with-imap-ssl=/export/home/imgdb/imap-2004' '--with-bz2' '--with-mcrypt=/export/home/imgdb' '--with-crypt' '--with-iconv=/export/home/imgdb' '--enable-cgi' '--enable-cli' '--with-mhash=/export/home/imgdb' '--with-tiff-dir=/export/home/imgdb' '--with-zlib=/export/home/imgdb' '--with-ttf' '--with-iconv-dir=/export/home/imgdb' '--with-freetype' '--with-freetype-dir=/export/home/imgdb' '--with-pear' '--with-mod_charset' '--with-apxs2=/export/home/imgdb/apache2.0.50/bin/apxs' '--with-gd' '--enable-gd-native-ttf' '--with-dom=/export/home/imgdb' '--with-dom-xslt=/export/home/imgdb' '--with-jpeg-dir=/export/home/imgdb' '--with-png-dir=/export/home/imgdb' '--with-dom-exslt=/export/home/imgdb' '--enable-force-cgi-redirect' '--enable-discard-path' '--enable-fastcgi' '--enable-rule=EAPI' '--enable-pcntl' '--enable-inline-optimizations' '--with-config-file-scan-dir=/export/home/imgdb/conf/php' '--prefix=/export/home/imgdb'


--relvevant DOM things
domxml

DOM/XML => enabled
DOM/XML API Version => 20020815
libxml Version => 20609
HTML Support => enabled
XPath Support => enabled
XPointer Support => enabled
DOM/XSLT => enabled
libxslt Version => 1.1.6
libxslt compiled against libxml Version => 2.6.8
DOM/EXSLT => enabled
libexslt Version => 1.1.6

---this also happens on a php 4.3.4 system (OS X) with these domxmls bits

domxml

DOM/XML => enabled
DOM/XML API Version => 20020815
libxml Version => 20603
HTML Support => enabled
XPath Support => enabled
XPointer Support => enabled
DOM/XSLT => enabled
libxslt Version => 1.1.1
libxslt compiled against libxml Version => 2.6.3
DOM/EXSLT => enabled
libexslt Version => 1.1.1
 [2004-07-30 09:09 UTC] chregu@php.net
use $dd->free() instead of unset($dd).
 [2004-07-30 17:41 UTC] bo at theaddedones dot com
hmm, i'm not sure this is a 'bogus' bug, there is no documentation on this little 'free' function (although is certainly works)...so perhaps the 'bug' is more of a documentation thing (i.e. i did not know the 'free' function exsisted)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 08:01:34 2025 UTC