Some time ago I created a patch to implement a ref_count() function which works the way you suggested. But I'm not sure if it's OK/complete... and I'm not sure if something like that is really needed in the core (and I'm definetly not the person to decide on that ;-)).

If you talk about objects, your patch exposes wrong refcount. Your patch exposes zval refcount, however there can be a number of zvals referring to the same object, and the actual object storage keeps its own refcount, see zend_objects_API.c (provided your object is a standard Zend object). Actually, since each of these zvals can hold own refcount and we can not know what variables refer to the given object, I do not see how one could really calculate the number of different places that the object is referred to, unless you know your application really well so you could know how many places refer to the object and what exactly they are.

--
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED]  http://www.zend.com/

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

Reply via email to