Re: PHP 4.0 Bug #5641: php module fails to release memory
| From: | Rasmus Lerdorf | Date: | Mon, 17 Jul 2000 15:16:44 +0000 |
| Subject: | Re: PHP 4.0 Bug #5641: php module fails to release memory | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-24775@lists.php.net to get a copy of this message | ||
Are you sure it has anything to do with that script? That shouldn't take
up very much memory at all, and on my system I don't see any noticeable
increase in memory usage.
Note that UNIX systems never release memory in the sense that you are
talking about. If I write a program that allocates 1M of memory and then
frees that 1M, then this 1M of memory is not given back to the operating
system. My process will show up as using 1M of RAM until the process
terminates. What freeing the memory does is mark it as being available
for re-use by this same process. That means if later on in my process I
need to allocate 500K, then I get this 500K out of the 1M I previously
freed and my process will still only be taking up 1M instead of 1.5M.
Since PHP never terminates, your httpd processes will grow to the size of
your most memory hungry script and stay there.
-Rasmus
On 17 Jul 2000 michel.jansens@ulb.ac.be wrote:
> From: michel.jansens@ulb.ac.be
> Operating system: Solaris 2.6
> PHP version: 4.0.1pl2
> PHP Bug Type: Scripting Engine problem
> Bug description: php module fails to release memory
>
> Before running the script below all httpd processes take 1169KB RAM and 9352 SWAP
>
> After one of the http process takes 6292KB RAM and 50,336KB SWAP
>
> Is this normal behaviour? is there a way to prevent this?
>
>
> <?php
> $a="0123456789";
> for($i=0;$i<21;$i++)$a.=$a;
> print strlen($a);
> unset($a);
> ?>
>
> Php module config:
> configure --enable-track-vars \
> --with-informix=/usr/products/informix \
> --with-imap=/usr/products/imap/imap-4.7/c-client \
> --enable-force-cgi-redirect \
> --with-apxs=/usr/products/apache1.3.12/bin/apxs
>
>
>
>