destruction of cross-referenced objects
| From: | Arnold Daniels | Date: | Tue, 05 Dec 2006 01:21:03 +0000 |
| Subject: | destruction of cross-referenced objects | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-26801@lists.php.net to get a copy of this message | ||
Hi,
I'm struggling with the problem that cross-referenced objects don't get destroyed. I can off course write a method to break the cross-reference, but that's kind of a pain in the butt, especially if the cross-reference is not strait forward.
To solve this I'm thinking of building one of 2 thing:
1.) Write a destroy() function which works much like a close function on a recourse, changing the object to a zval of type 'unknown'.
2.) Specify that a property of an object does not count for the reference count of a zval.
3.) Write code to find cross-references and destroy the objects still.
The first solution should be quite easy to implement, but you need to call destroy() to free the object, introducing the whole alloc/free responsibility thing to PHP.
The second solution would require some extra keyword within the class, but require no special code within the code using the object. Though I wouldn't have a clue how how to implement this or what would be the consequences.
I don't think the third solution is really possible or would at least cause performance problems.
I could use some comment on this problem. Or perhaps I'm just looking at it from a complete wrong angle.
Thanks,
Arnold
PS. I don't want to start a 'cross-referencing is wrong' discussion. I use it, because it's useful in some occasions.