Re: Freeing arrays in Zend [ Was: Stacktrace in errormessages]
| From: | Andrei Zmievski | Date: | Mon, 18 Dec 2000 14:13:25 +0000 |
| Subject: | Re: Freeing arrays in Zend [ Was: Stacktrace in errormessages] | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-41746@lists.php.net to get a copy of this message | ||
On Sat, 16 Dec 2000, Ragnar Kjørstad wrote:
> Hi
>
> I sent this message to the list a few weeks ago, but didn't get any
> response, so I'm giving it another shot.
>
> Specificly, I need to know if the following is correct:
>
> zval *a;
> ALLOC_INIT_ZVAL(a);
> array_init(a);
> add_next_index_string(a, string, 1);
> add_next_index_string(a, string2, 1);
> // hmm
> FREE_ZVAL(a);
>
> or if it's leaking memory, and I need to do some magic before FREE_ZVAL
> to free the copies of the strings and the array-metadata.
you need to do zval_dtor(a) or zval_del_ref(&a) (the latter will also do
FREE_ZVAL(a) if the refcount is 0)
-Andrei
* Black holes are where God divided by zero. *