Re: Help on ZVAL (array) memory management

From: Date: Tue, 26 Dec 2000 18:33:41 +0000
Subject: Re: Help on ZVAL (array) memory management
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-42281@lists.php.net to get a copy of this message
Hi On Tue, Dec 26, 2000 at 12:38:46PM -0500, Huajie Liu wrote: > Hi all, > I am writing a C extension for PHP using zend API. But I got > serious memory leak problem. They seems related to freeing > zval hashtable. The following is a snippet of my code: > > MAKE_STD_ZVAL (myzval); > if (array_init (myzval) == FAILURE) > { > } > ZEND_SET_SYMBOL (myzval->value.ht, key, zarray); > > > Can anyone give me some pointer on when and how to release > the memory allocated? It will be hihgly appreciated if Not sure what to say to when, except that you should free all memory you allocate before returning from the function, unless it belongs to the data you are returning. I think all you need to do is zval_dtor(myzval); > you can also point me some documents I can read through. Personally I mostly look at code that does similar things to what I want to do and look at the Zend source. The documentation at http://www.zend.com/apidoc/ might be of some help too. Stig

« previous php.dev (#42281) next »