RFC: Remove "destructor" from PEAR class
| From: | Alexey Borzov | Date: | Wed, 16 Jun 2004 14:26:06 +0000 |
| Subject: | RFC: Remove "destructor" from PEAR class | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-30771@lists.php.net to get a copy of this message | ||
Hi,
This problem was already mentioned on the web [1] but did not receive enough coverage here.
PEAR class has this abomination
function _PEAR() {
if ($this->_debug) {
printf("PEAR destructor called, class=%s\n", get_class($this));
}
}
as the "destructor". And when the constructor of the child class calls PEAR's constructor, it checks whether the class or any of the *parent* classes have a "destructor". Thus each class that extends PEAR, EVEN IF IT DOES NOT USE THE DESTRUCTOR FEATURE ITSELF, gets registered in PEAR's list of objects, preventing garbage collection. This creates a huge problem for long running scripts.
I hit the problem trying to mirror a large enough site. Current version of Net_Socket (1.0.2), used by HTTP_Request, used by HTTP_Client, used by my mirroring script extends PEAR. So for every page the script requests an instance of Net_Socket gets registered in the destructor list and the script eventually grows beyond the 8Mb limit. Oops.
Now, as the "destructor" thing is completely useless and just causes trouble I suggest removing it.
I'd like to hear either of the two responses:
1) Yes, we will remove this.
2) No, we will not remove this for the following reasons: ...
I specifically don't want to hear the usual BS about "don't include / extend / touch with a 10 ft pole" PEAR.php, as there are existing packages that suffer from this.
[1] http://www.procata.com/blog/archives/2004/05/27/rephlux-and-php-memory-usage/