Re: [PHP-DEV] Freeing arrays in Zend [ Was: Stacktrace in errormessages] From: Andrei Zmievski (andrei <email protected>)
Date: 12/18/00

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. *

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>