[PHP4BETA] resource-handling....
| From: | Thies C. Arntzen | Date: | Sun, 25 Apr 1999 12:08:55 +0000 |
| Subject: | [PHP4BETA] resource-handling.... | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-505@lists.php.net to get a copy of this message | ||
hi,
about refrence-counting & freeing of IS_RESOURCE:
it seems to me that i HAVE to add all my resources to list or plist to get
php4 to free my db-cursors etc..
zend_variables.c:84:
case IS_RESOURCE:
/* destroy resource */
zend_list_delete(zvalue->value.lval);
break;
i'm not quite sure, but in my oci8 driver i use my own HashTable * stuff,
'cause for me the order of the frees are very importent (cursors before
connections, connections before server-handles) - and therefore i don't
put my resources into list or plist. i do all the bookkeeping myself in
mshutdown and rshutdown.
this is not going to work with php4 as of now.
if you followed the thread on thursday you would see that we run into some
recursion if we do a list_apply in our shutdown function and that stuff
gets freed more than once....
my oci8 stuff works fine, but i've just mentioned to php-dev that we have
the same serializing problem in oracle.c because oracle.c uses list and
plist and thereby has no real control over the order of the frees....
what should i do???
i think it would be kind-of-nice if the module could specify it's own
desctructor routine in a zval (add another 32/64 bits to zval), and php4
would call that to "clean-up"....
(could be that i've overseen something, i'm right now not sure if i'm a
pointer or a handle;-)....
tc
--
PHP 4 Beta