Re: freeing zvals ref count
| From: | Etienne Kneuss | Date: | Tue, 24 Apr 2012 23:28:35 +0000 |
| Subject: | Re: freeing zvals ref count | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-60302@lists.php.net to get a copy of this message | ||
Hi,
On Wed, Apr 25, 2012 at 01:25, Yader Hernandez
<yader.hernandez@gmail.com> wrote:
> Hello,
>
> In the extension I'm currently working on, I call add_index_zval and on
> success, I call Z_ADDREF_P on the new zval.
>
> When I'm freeing everything, I need to remove the ref count. Digging
> through the source code, I found Z_DELREF_P. Would this be the correct
> macro to call? Is there anything else to keep in mind when calling it?
You should use zval_ptr_dtor instead. it will delref and free in case
the refcount hits 0.
Best,
>
> thx
--
Etienne Kneuss
http://www.colder.ch