Hi Nathanael,
If you've been watching the list you could have seen that David Wang
(god bless his soul) is working on this at the moment. Have a look at
http://marc.info/?l=php-dev&m=118418663902191&w=2.
You'll have to stick with your custom solution for now though.
Best regards,
Arnold
Nathanael D. Noblet wrote:
Hello,
I have a case where an object has a few variables, a couple of which
are objects which hold references back to this object.
So very simply something like
class A {
var B
}
class B {
var A
}
When doing something like so
$obj = new A(); in a loop the object's never released from memory
because of the internal references it holds. __destruct is not called
until the end of script execution etc. Now normally in a web request
situation this isn't a big deal. However I'm using it in a batch and
loop over 22 000 records. Since re-assigning the single object I use
isn't freeing any memory it consumes quite a bit. I have gotten around
it by creating a special function in the object to manually release
the recursive references. However it would be nice if there were some
sort of 'magic' function that could be called on an object so that it
knows it is being deleted, sort of like a __preDestruct or something
like that... Is that a bad idea? Or I guess better able to handle
recursive references in objects would be the other way to solve it I
guess.
Any feedback is welcome.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php