RE: Re: Freeing memory for DOMDocument

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Maybe you could find and answer here:

http://drupal.org/node/81037

Some people have the same problem, i was this trouble in the past and i fix it increasing the memory_limit in php.ini file

Anyway read the posts in the url that i wrote.



> To: php-general@xxxxxxxxxxxxx; jcboget@xxxxxxxxx
> Date: Wed, 7 Jan 2009 15:21:50 +0000
> From: nrixham@xxxxxxxxx
> CC: php-general@xxxxxxxxxxxxx
> Subject:  Re: Freeing memory for DOMDocument
> 
> Christoph Boget wrote:
> > I'm running through a large dataset and am generating/manipulating XML
> > documents for each record.  What's happening is that after a while, I
> > get a fatal error saying:
> > 
> > Fatal error: Allowed memory size of 167772160 bytes exhausted (tried
> > to allocate 32650313 bytes)
> > 
> > Each XML file I generate (an manipulate) can range from just a few
> > megs to upwards of 35 megs.  Judging from the error above, it looks
> > like the memory for the DOMDocument objects I instantiate is not
> > getting freed; it just continues to stay in memory until the memory is
> > completely exhausted.  The method (in my object) I am using to
> > instantiate a new DOMDocument is as follows:
> > 
> >     protected function createCleanDomDocument()
> >     {
> > /*
> >       if(( isset( $this->oDomXPath )) && ( !is_null( $this->oDomXPath )))
> >       {
> >         unset( $this->oDomXPath );
> >       }
> > 
> >       if(( isset( $this->oDomDocument )) && ( !is_null( $this->oDomDocument )))
> >       {
> >         unset( $this->oDomDocument );
> >       }
> > */
> >       $this->oDomDocument = new DOMDocument( '1.0', 'iso-8859-1' );
> >       $this->oDomXPath    = new DOMXpath( $this->oDomDocument );
> >     }
> > 
> > which is used in both the constructor of my object and in a few other
> > places.  I would think that when the new DOMDocument is instantiated,
> > the memory used for the old value would get freed.  As you can see,
> > I've even tried to unset the variables but that doesn't seem to help
> > matters much, either.
> > 
> > Does anyone know how (or even if) I can explicitly free the memory
> > used for the DOMDocument?  Any help/advice would be greatly
> > appreciated!
> > 
> > thnx,
> > Christoph
> 
> I've had exactly the same problem and couldn't find a way around it; 
> even after unsetting every variable in my scripts inside a for/while 
> loop; in the end I opted for a CLI script which opened worker threads 
> then killed/restarted them when memory usage was X.
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

_________________________________________________________________
Chatea en Messenger desde Hotmail.
http://download.live.com

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux