Re: PHP 4.0 Bug #5620 Updated: Memory leaks with classes and references to objects

From: Date: Wed, 16 Aug 2000 02:07:08 +0000
Subject: Re: PHP 4.0 Bug #5620 Updated: Memory leaks with classes and references to objects
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-29087@lists.php.net to get a copy of this message
I have two proposals regarding this memory leak cases 1. Having a force_unref() function that a user can explicitly mark his/her variable as unreferenced (ref_count = 0) in the end of his/her script, so it can then be deallocated. It might not be a polite manner, but it can break the circular reference. 2. Tagging the variables with the script run id, so that when the script ends, it can sweep the memory and deletes everything that has its run id, referenced or not. The reason is that objects are associated with instances of the script, and meaningless outside the scripts or when the associated scripts have died. This has a memory penalty for the tagging and the sweeps, that it might better be a config option for people that does circular refs but don't want the leaks. I think it would be a fair tradeoff. I would like to hear what others think about this matter. regards Mark Melvin ----- Original Message ----- From: "Bug Database" <php-dev@lists.php.net> To: <php-dev@lists.php.net> Sent: Wednesday, August 16, 2000 01:32 Subject: [PHP-DEV] PHP 4.0 Bug #5620 Updated: Memory leaks with classes and references to objects > ID: 5620 > Updated by: waldschrott > Reported By: h.raaf@i-k-c.net > Status: Closed > Bug Type: Scripting Engine problem > Assigned To: > Comments: > > 1) > leaking memory is the intended behaviour using circular > references > 2) > you can do (in your code)... > > $oa->Bref->Aref->Bref->Aref->Bref............. > how often you want to, that´s circular >

« previous php.dev (#29087) next »