Note that the engine does not guarantee you any particular value of the refcount. Passing parameters around, accessing variables, etc. may change the refcount. One thing the engine guarantees you is that once no links to the variable exist it would be destroyed (which may not happen immediately after you do unset, for example, but probably would happen "soon"). So actually figuring out if the object is referenced by any other place could prove non-trivial, depending on the application structure.


I don't understand the problem really, because I am aware that even a parameter counts as a reference (why not?)...it wouldn't matter in my case because I am in total control of the last two references...so if there are more, I keep it. Tracking the references manually is not really an option because it's such a large project.

I don't understand the part about the engine not guaranteeing the destruction immediately. Because as soon as the ref-count decreases to zero it can be removed from memory...it's different in java and other languages which don't use ref-count but more complex algorithms like mark-and-sweep and such, they only are run once in a while and may not be triggered manually...so, I'd understand it in that case.

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to