Re: module global becomes executor globals then back again
| From: | Wez Furlong | Date: | Sun, 04 Sep 2005 16:48:46 +0000 |
| Subject: | Re: module global becomes executor globals then back again | ||
| References: | 1 2 3 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-2858@lists.php.net to get a copy of this message | ||
emalloc()/efree() can only be used in between RINIT and RSHUTDOWN;
after rshutdown, all emalloc'd memory is freed. zvals use emalloc()'d
memory, so on the second request, your global variable was corrupted.
As a general rule, you can't keep any kind of zval around between requests.
--Wez.
On 9/4/05, Nick Loeve <php@trickie.org> wrote:
> Yeah i knew it was vague, but i was not sure why or how to begin, i was
> just hoping that it sounded like a common problem :)
>
> It was caused by my setting a zval * as global variable, and allocating
> it during a ini update method, so i assume the memory was being freed at
> the end of the first request?? Not sure about that either.
>
> I changed it to a HashTable and it is now all good.
>
> Thanks anyway
>
> Wez Furlong wrote:
> > A vague answer for a vague question: sounds like you're doing something wrong.
> > If you can give more info, I'm sure you'll get a better answer.
> >
> > --Wez.
> >
> > On 9/4/05, Nick Loeve <php@trickie.org> wrote:
> >
> >>Hi!
> >>
> >>I have a wierd problem in an extension i am developing, and was hoping
> >>to get some pointers on how to debug it.
> >>
> >>I have a global variable in my module, that gets initialized as an array
> >>at module start up. I have a function that returns that array, and the
> >>first request that gets serviced returns that array as expected.
> >>
> >>Any subsequent requests return the entire executor globals with the
> >>$GLOBALS referencing itself??
> >>
> >>If i wait 2 mins (and am guessing that the apache processes die and
> >>respawn) then the array is returned correctly again the first time, but
> >>not on subsequent requests.
> >>
> >>I am using a current CVS export of 5_1 and Apache 1.3.
> >>
> >>Any pointers would be appreciated.
> >>
> >>Cheers
> >>Nick Loeve
> >>
> >>--
> >>PECL development discussion Mailing List (http://pecl.php.net/)
> >>To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >
> >
>