php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10667 xmltree function cause memory leak
Submitted: 2001-05-04 11:29 UTC Modified: 2002-06-03 18:19 UTC
From: dmc at planet dot it Assigned:
Status: Closed Package: DOM XML related
PHP Version: 4.0.5 OS: Linux 2.2.16
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: dmc at planet dot it
New email:
PHP Version: OS:

 

 [2001-05-04 11:29 UTC] dmc at planet dot it
My code:

-----------------------------------------------------------------------
<?php
$fd = fopen("file.xml","r") or die ("Unable to open file!");
$myXML = fread($fd,filesize("file.xml"));
fclose($fd);

$docTree = xmltree($myXML);

echo $docTree->version;
?>
--------------------------------------------------------------------------

The file.xml  is:
------------------------------------------------------------------------------
<?xml version="1.0"?>
<ListaSoftware>
        <Software>
                <SoftwareName><![CDATA[Nero Burning Rom(e) INTERNATIONAL PATCHES]]></SoftwareName>
                <Produttore>
                        <NomeProduttore><![CDATA[Ahead]]></NomeProduttore>
                        <UrlProduttore><![CDATA[www.ahead.de]]></UrlProduttore>
                </Produttore>
                <Descrizione><![CDATA[Permette di visualizzare i comandi di Nero Burning Rom(e) in altre lingue ]]></Descrizione>
                <Versione><![CDATA[5.0.3.8]]></Versione>
                <Licenza>
                        <TipoLicenza><![CDATA[Shareware]]></TipoLicenza>
                        <LinkDescrLicenza><![CDATA[http://www.vitaminic.it/help/software/licenze/dist4.shtml]]></LinkDescrLicenza>
                </Licenza>
                <Aggiornamento><![CDATA[2001-02-09]]></Aggiornamento>
                <SistemiOperativi>
                        <SistemaOperativo><![CDATA[Windows 95/98/NT]]></SistemaOperativo>
                </SistemiOperativi>
                        <GenereSoftware><![CDATA[Masterizzazione]]></GenereSoftware>
                <Lingua><![CDATA[Italiano]]></Lingua>
                        <Download>
                        <DimensioneFile><![CDATA[397]]></DimensioneFile>
                        <UrlDownload><![CDATA[http://www.vitaminic.it/cgi-php/get_file.php3?modo=100&swid=&file=Nero Burning Rom(e) INTERNATIONAL PATCHES]]></UrlDownlo                </Download>
                <Voto>5</Voto>
        </Software>
        <Software>
                <SoftwareName><![CDATA[WinAMP Mac Version]]></SoftwareName>
                <Produttore>
                        <NomeProduttore><![CDATA[Nullsoft]]></NomeProduttore>
                        <UrlProduttore><![CDATA[www.winamp.com]]></UrlProduttore>
                </Produttore>
                <Descrizione><![CDATA[La versione per Mac del celebre riproduttore per file MP3.]]></Descrizione>
                <Versione><![CDATA[0.71 Alpha]]></Versione>
                <Licenza>
                        <TipoLicenza><![CDATA[Freeware]]></TipoLicenza>
                        <LinkDescrLicenza><![CDATA[http://www.vitaminic.it/help/software/licenze/dist2.shtml]]></LinkDescrLicenza>
                </Licenza>
                <Aggiornamento><![CDATA[2001-03-30]]></Aggiornamento>
                <SistemiOperativi>
                        <SistemaOperativo><![CDATA[Macintosh]]></SistemaOperativo>
                </SistemiOperativi>
                        <GenereSoftware><![CDATA[Riproduttori]]></GenereSoftware>
                <Lingua><![CDATA[Italiano]]></Lingua>
                        <Download>
                        <DimensioneFile><![CDATA[177]]></DimensioneFile>
                        <UrlDownload><![CDATA[http://www.vitaminic.it/cgi-php/get_file.php3?modo=100&swid=&file=WinAMP Mac Version]]></UrlDownload>
                </Download>
                <Voto>5</Voto>
        </Software>
</ListaSoftware>
-----------------------------------------------------------------------------------------

When I start apache I have:

20562 ?        S      0:00      3   739  8700 4448  1.7 /bin/httpd -d / -f /conf
20563 ?        S      0:00      3   739  8700 4448  1.7 /bin/httpd -d / -f /conf
20564 ?        S      0:00      3   739  8700 4448  1.7 /bin/httpd -d / -f /conf
20565 ?        S      0:00      3   739  8700 4448  1.7 /bin/httpd -d / -f /conf
20566 ?        S      0:00      3   739  8700 4448  1.7 /bin/httpd -d / -f /conf
20567 ?        S      0:00      3   739  8700 4448  1.7 /bin/httpd -d / -f /conf
20568 ?        S      0:00      3   739  8700 4448  1.7 /bin/httpd -d / -f /conf
20569 ?        S      0:00      3   739  8700 4448  1.7 /bin/httpd -d / -f /conf
20570 ?        S      0:00      3   739  8700 4448  1.7 /bin/httpd -d / -f /conf
20571 ?        S      0:00      3   739  8700 4448  1.7 /bin/httpd -d / -f /conf
20572 ?        S      0:00      3   739  8700 4448  1.7 /bin/httpd -d / -f /conf
20573 ?        S      0:00      3   739  8700 4448  1.7 /bin/httpd -d / -f /conf
20574 ?        S      0:00      3   739  8700 4448  1.7 /bin/httpd -d / -f /conf
20575 ?        S      0:00      3   739  8700 4448  1.7 /bin/httpd -d / -f /conf
20576 ?        S      0:00      3   739  8700 4448  1.7 /bin/httpd -d / -f /conf

After I reloaded my php script for 75 times, the situation changed to:

20562 ?        S      0:00     97   739  9892 6004  2.3 /bin/httpd -d / -f /conf
20563 ?        S      0:00    104   739  9276 5388  2.1 /bin/httpd -d / -f /conf
20564 ?        S      0:00    102   739  9120 5240  2.0 /bin/httpd -d / -f /conf
20565 ?        S      0:00     94   739 10048 6160  2.4 /bin/httpd -d / -f /conf
20566 ?        S      0:00     94   739  9740 5852  2.2 /bin/httpd -d / -f /conf
20567 ?        S      0:00     90   739  9272 5376  2.0 /bin/httpd -d / -f /conf
20568 ?        S      0:00     94   739  9428 5552  2.1 /bin/httpd -d / -f /conf
20569 ?        S      0:00     95   739  9584 5704  2.2 /bin/httpd -d / -f /conf
20570 ?        S      0:00     90   739 10048 6152  2.3 /bin/httpd -d / -f /conf
20571 ?        S      0:00     90   739  9272 5376  2.0 /bin/httpd -d / -f /conf
20572 ?        S      0:00     99   739  9120 5240  2.0 /bin/httpd -d / -f /conf
20573 ?        S      0:00    100   739  9892 6004  2.3 /bin/httpd -d / -f /conf
20574 ?        S      0:00     95   739  9892 6012  2.3 /bin/httpd -d / -f /conf
20575 ?        S      0:00     93   739  9736 5848  2.2 /bin/httpd -d / -f /conf
20576 ?        S      0:00     94   739  9428 5540  2.1 /bin/httpd -d / -f /conf

I also have problems when I try to access  a CDATA  field's content.
For example, when I call the children() method of a node who have 
a child of type CDATA,  my server receives a  Segmentation fault signal.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-22 03:31 UTC] mfischer@php.net
Can you try with latest RC and see if it works

http://www.php.net/~zeev/php-4.1.0RC3.tar.gz

Feedback.


 [2001-11-30 20:46 UTC] mfischer@php.net
Update: CDATA should already work with current CVS; some minor fixes are coming.

Assigned to me.
 [2001-12-01 14:46 UTC] mfischer@php.net
Should be fixed in CVS. Closing.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 01:01:30 2024 UTC