Re: PHP Extension Memory Problems

From: Date: Thu, 22 Apr 2004 16:38:36 +0000
Subject: Re: PHP Extension Memory Problems
Groups: php.internals 
Request: Send a blank email to internals+get-9489@lists.php.net to get a copy of this message
Wez Thanks for the information. Unfortunately, when I try: // This part of the extension is in a function that may well be called // several thousand times from a PHP script. SEPARATE_ZVAL(&Arr); array_init(Arr); The second time through, the httpd process segfaults and dies. Apparently, I can't just blindly do the separate_zval and array init. I have tried several combinations using the ZVAL_IS_NULL and Z_TYPE_P() == IS_ARRAY beforehand, but I'm just not getting it. Bruce
From: "Wez Furlong" <wez@thebrainroom.com> To: "Bruce Bailey" <bruce1828@hotmail.com>, <internals@lists.php.net> Subject: Re: [PHP-DEV] PHP Extension Memory Problems Date: Wed, 21 Apr 2004 22:04:19 +0100 What can I do in my extension to unset or clear the variable so that it doesn’t have to be done in the PHP script? if (!PZVAL_IS_REF(Arr)) { zend_error(E_ERROR, "The Arr parameter must be passed by reference");
                ^^^^^^^
Don't use E_ERROR in an extension unless it would be dangerous for execution to continue (eg: crash iminent); use E_WARNING instead. RETURN_NULL(); } SEPARATE_ZVAL(Arr); array_init(Arr); if (add_assoc_string(Arr, (char *) szFieldName, (char *) szValue, 1) == FAILURE) { . . . } Hope that helps, --Wez.
_________________________________________________________________ Is your PC infected? Get a FREE online computer virus scan from McAfee® Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

« previous php.internals (#9489) next »