Re: pear memory usage
| From: | Greg Beaver | Date: | Mon, 28 Feb 2005 21:41:18 +0000 |
| Subject: | Re: pear memory usage | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-17734@lists.php.net to get a copy of this message | ||
Trevan Devaun Richins wrote:
I have a script that uses DB_DataObject for database connection and I have it as a daemon on our server. It runs fine for a few weeks, and then it dies with the error: <b>Fatal error</b>: Allowed memory size of 8388608 bytes exhausted (tried to allocate 128 bytes) in b>/usr/share/pear/DB/DataObject.php</b> on line <b>509</b> I first checked my code to make sure that it is unsetting every variable that could be taking up memory. I run free() on all the dataobjects that I have. This has allowed the script to run for a few more days, but I am still getting this error. My question is how can I clean up the memory? I have looked online and found something about a global variable called $_PEAR_destructor_object_list that is never cleared. Can I unset this variable?This is an array of references. Since your script never finishes, the destructors are never called. Yes, you can unset it, but make sure you do after each creation of a DB_DataObject, or it will be re-created. However, in your case, I would recommend hacking into PEAR.php directly and removing the destructor initialization code in PEAR::PEAR(). Greg