Re: Dom PDF Problem

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

 



This  might help some people struggling with memory leak problems in
DOMPDF. I haven't fixed it but it seems to have reduced the memory leak
considerably.

I have done 2 things:

1.
Added a detruct function to the DOMPDF file in dompdf.cls.php where I
unset everything. I call this each time in my loop when I'm using DOMPDF
mulitple times:

function __destruct()
{
  unset($this->_messages);
  unset($this->_xml);
  unset($this->_tree);
  unset($this->_css);
  unset($this->_pdf);
  unset($this->_paper_size);
  unset($this->_paper_orientation);
  unset($this->_base_host);
  unset($this->_base_path);
  unset($this->_cache_id);
}

2.
I now added within the render function of DOMPDF a call to the function
dispose to clean up anything left from before:

// This is where the magic happens:
$root->reflow();
	
// Memory leak fix
$root->dispose(true);

// Clean up cached images
Image_Cache::clear();


Also worth mentioning that I increased my memory allocation in my
php.ini to about 256MB, and the max execution time to about 120 seconds.

As mentioned this won't fix the problem but it does reduce the memory
used.


Chris
No virus found in this outgoing message.
Checked by AVG - www.avg.com 
Version: 8.5.416 / Virus Database: 270.13.112/2388 - Release Date:
09/23/09 05:52:00
No virus found in this outgoing message.
Checked by AVG - www.avg.com
Version: 8.5.416 / Virus Database: 270.13.112/2390 - Release Date: 09/23/09 05:52:00
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[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