Re: Input paramters...
| From: | David Muse | Date: | Thu, 23 Nov 2000 22:02:55 +0000 |
| Subject: | Re: Input paramters... | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-39037@lists.php.net to get a copy of this message | ||
On Thursday 23 November 2000 03:54, Sterling Hughes wrote:
> At 04:34 PM 11/22/2000 -0500, David Muse wrote:
> > > >After calling zend_get_parameters, are the zval's that it returns
> > > > appear to be deallocated automatically when the function terminates.
> > > > Is this proper behavior?
> > >
> > > Yes. It's one of the main reasons that built-in functions are
> > > relatively leak safe.
> > >
> > > >The issue is as follows:
> > > >....
> > >
> > > Yes. It's also very efficient, even though I realize it may not seem
> > > like that from your point of view (I'm way too tired to explain why
> > > it's efficient).
> > >
> > > Zeev
> >
> >That's cool, I just wanted to confirm that I was on the right track.
> >
> >I guess what's going on is; I'm adding another reference to that variable
> >that the engine can't be aware of. If I increment that variables refcount
> >then it shouldn't get deallocated when the function exits, but then how
> >can I assure that it will ultimately get deallocated? Would I have to
> >decrement it again somewhere?
> >
> >Is there a standard way to do what I'm trying to do?
>
> What's wrong with estrndup'ing the variable?
>
> -Sterling
Nothing, if it will work.
Having thought about it more, I don't think that estrdup'ing it will solve
the problem. When the function exits, there would be no references (that PHP
is aware of) to the new variable, just like there aren't any (that PHP is
aware of) to the parameter.
I could be wrong about this though, I'm pretty new to PHP.
Dave Muse
david.muse@zapmedia.com