Re: [PHP4BETA] Freeing zval

From: Date: Mon, 04 Oct 1999 14:20:21 +0000
Subject: Re: [PHP4BETA] Freeing zval
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-5128@lists.php.net to get a copy of this message
On Mon, 4 Oct 1999, Uwe Steinmann wrote: > Hi, > > I would like to use a zval internally to store some data. > For this I create an array and fill it with some data: > > MAKE_STD_ZVAL(spec_arr); > array_init(spec_arr); > add_assoc_long(spec_arr, "Title", HW_ATTR_LANG); > add_assoc_long(spec_arr, "Description", HW_ATTR_LANG); > add_assoc_long(spec_arr, "Keyword", HW_ATTR_LANG); > add_assoc_long(spec_arr, "Group", HW_ATTR_NONE); > > In order to get rid of it I currently do the following: > > spec_arr->refcount--; > zend_hash_destroy(spec_arr->value.ht); > efree(spec_arr); > > and I wonder if this is the way to do it. There seems to > be at least one problem because it leaks 44 bytes (can > see what else could cause it). > > Any comments? > > Uwe > > PS: The code can be found in ext/hyperwave/hw.c:283 hi uwe - the code does not seem to be commited... anyhow: zval *arr; MAKE_STD_ZVAL(arr); array_init(arr); add_assoc_long(arr, "Title", 1); .. do things with arr .. zval_dtor(arr); efree(arr); leaves *no* trace of arr... regards, tc > -- > Uwe.Steinmann@fernuni-hagen.de > Tel: +2331 987 4528 Fax: +2331 987 375 > > -- > PHP 4 Beta > > 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

« previous php.version4 (#5128) next »