Re: [PHP4BETA] Automatic resource deallocation fails
| From: | thies at digicol dot de | Date: | Fri, 17 Mar 2000 02:04:13 +0000 |
| Subject: | Re: [PHP4BETA] Automatic resource deallocation fails | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-12299@lists.php.net to get a copy of this message | ||
On Thu, Mar 16, 2000 at 04:04:32PM +0100, Till Gerken wrote:
> Hello,
>
> I am trying to make use of automatic resource deallocation. Registering a
> destructor for a resource is no problem, doing
>
> zend_list_insert()
> zend_list_delete()
>
> will properly call the destructor.
>
> However, when I assign the resource value to a pval container and pass it
> back as return value from a function, as soon as all references to this pval
> container are lost (calling unset() on the variable, overwriting it with
> different values etc.), the destructor is not being called.
>
> Am I required to decrease the reference count manually somewhere?
no - that's all done for you.
dir.c is the shortes source out there that uses resources -
use that as a sample.
>
> Till
>
>
>
> --
> PHP 4.0 Beta Mailing List <http://www.php.net/version4/>
> To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net
> For additional commands, e-mail: php4beta-help@lists.php.net
> To contact the list administrators, e-mail: php4beta-admin@lists.php.net
>
--
Thies C. Arntzen "One Big-Mac, Small Fries and a Coke!"
Digital Collections Phone +49 40 235350 Fax +49 40 23535180
Hammerbrookstr. 93 20097 Hamburg / Germany