Re: cvs: php4 /sapi/fastcgi fastcgi.c
| From: | Ben Mansell | Date: | Thu, 03 May 2001 13:26:23 +0000 |
| Subject: | Re: cvs: php4 /sapi/fastcgi fastcgi.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-5506@lists.php.net to get a copy of this message | ||
On Thu, 3 May 2001, Andi Gutmans wrote:
> At 01:15 PM 5/3/2001 +0100, Ben Mansell wrote:
> >On Wed, 2 May 2001, Andi Gutmans wrote:
> >
> > > Won't it leak memory for each request? Will messing directly with environ
> > > work on all platforms?
> >
> >Yes, it leaks on every request, we waste 'sizeof(char *)' for each
> >variable per request. Unfortunately it seems unavoidable, on some
> >platforms if I try to clean up our environ after running the script, it
> >crashes. I still haven't figured out why yet. The fastcgi runner however
> >will kill off its children every 'n' requests and start some more, so
> >the memory leak will now grow too large.
>
> This might be because if the script does a putenv() it might be changing
> your original environ.
Yes, this (I think) was the problem. After the script is finished, the
environ pointer could well be different. I can't remember the exact
details, but the problem is that on some platforms, you may not be able
to free the original memory you allocated, since others could have
realloc()d it away from its original location. And you can't free()
the new environ, since theres no guarantee that it is freeable. It's all
a bit nasty.
> >As for whether this works on all platforms, I can safely say it works on
> >all the following:
>
> With all those machine's you should join the PHP QA team :)
I'm looking at seeing if I can integrate the PHP test suite into the
build systems here, as it happens. But no guarantees...
Ben
--
Ben Mansell, <ben@zeus.com> Zeus Technology Ltd
Download the world's fastest webserver! Universally Serving the Net
T:+44(0)1223 525000 F:+44(0)1223 525100 http://www.zeus.com
Zeus House, Cowley Road, Cambridge, CB4 0ZT, ENGLAND