Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #7555

Re: php daemon

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: php daemon
Date 2012-11-14 16:33 -0500
Organization A noiseless patient Spider
Message-ID <k812n1$fo2$1@dont-email.me> (permalink)
References (6 earlier) <k7p84u$p0f$1@speranza.aioe.org> <k7pbaa$dbo$1@dont-email.me> <k7qtt2$fvk$1@speranza.aioe.org> <k7tfb8$lgn$1@dont-email.me> <k80uci$m01$1@speranza.aioe.org>

Show all headers | View raw


On 11/14/2012 3:19 PM, Christoph Becker wrote:
> Jerry Stuckle wrote:
>> I thought of something else you may be misunderstanding.  This is NOT
>> the amount of memory allocated to PHP by the OS.  That is in multiples
>> of 4K blocks (for Intel architecture).  It is the amount actually
>> allocated for use by PHP.  Once that figure reaches the maximum memory
>> defined in the php.ini file, no more memory can be allocated by the script.
>
> I'm aware of the $real_usage parameter of memory_get_usage() and the
> different results reported according to the value of this parameter.
> And I assume, that the following invariant holds:
>
>      memory_get_usage(true) >= memory_get_usage(false)
>
>> Your interpretation would provide pretty worthless information as it
>> would not give a true account of memory being used.
>
> Isn't the true amount of memory being used by PHP (independent on how
> much is allocated by the OS) the relevant information for the given test?
>

Yes, and if a variable has been unset, it's storage is no longer being 
used by PHP.  It's in the pool to be cleaned up by the garbage 
collector, but that's different.

> However, reading
> <http://www.php.net/manual/en/features.gc.collecting-cycles.php> and
> <https://wiki.php.net/internals/zend_mm> still let's me assume, that
> zvals which refcount drops to zero are immediately freed (/not
> necessarily given back to the OS, though/).  The following test
> /supports/ my assumption (it's no prove, though):
>
> for ($i = 0; $i < 99; $i++) {
>      for ($j = 0; $j < 10000; $j++) {
>          $a = uniqid();
>      }
>      echo memory_get_usage(true), "\n";
> }
>
> Even if 990,000 uniqid()s (having 13 bytes each) will be allocated, on
> my PHP 5.4.7 on Windows XP the output are 99 lines with 262144,
> independent of the setting of zend.enable_gc.
>

That is correct.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

php daemon "sl@exabyte" <sb5309@hotmail.com> - 2012-11-12 01:18 +0800
  Re: php daemon Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-11 14:04 -0500
    Re: php daemon Christoph Becker <cmbecker69@gmx.de> - 2012-11-11 21:05 +0100
      Re: php daemon Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-11 15:35 -0500
        Re: php daemon Christoph Becker <cmbecker69@gmx.de> - 2012-11-11 22:22 +0100
          Re: php daemon Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-11 16:36 -0500
            Re: php daemon Christoph Becker <cmbecker69@gmx.de> - 2012-11-11 23:17 +0100
              Re: php daemon Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-11 18:11 -0500
                Re: php daemon Christoph Becker <cmbecker69@gmx.de> - 2012-11-12 14:35 +0100
                Re: php daemon Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-12 08:38 -0500
                Re: php daemon Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-13 07:44 -0500
                Re: php daemon Christoph Becker <cmbecker69@gmx.de> - 2012-11-14 21:19 +0100
                Re: php daemon Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-14 16:33 -0500
                Re: php daemon Christoph Becker <cmbecker69@gmx.de> - 2012-11-14 23:13 +0100
                Re: php daemon Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-15 07:41 -0500
                Re: php daemon Christoph Becker <cmbecker69@gmx.de> - 2012-11-15 16:55 +0100
    Re: php daemon "sl@exabyte" <sb5309@hotmail.com> - 2012-11-12 23:45 +0800
      Re: php daemon The Natural Philosopher <tnp@invalid.invalid> - 2012-11-12 16:08 +0000
  Re: php daemon Goran <goran@nospam.com> - 2012-11-13 08:57 +0100
    Re: php daemon Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-13 07:47 -0500
      Re: php daemon Goran <goran@nospam.com> - 2012-11-13 14:54 +0100
        Re: php daemon The Natural Philosopher <tnp@invalid.invalid> - 2012-11-13 14:13 +0000
        Re: php daemon Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-13 12:23 -0500
          Re: php daemon Goran <goran@nospam.com> - 2012-11-14 08:43 +0100
            Re: php daemon Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-14 05:51 -0500
              Re: php daemon Goran <goran@nospam.com> - 2012-11-15 14:08 +0100
                Re: php daemon Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-15 08:46 -0500
                Re: php daemon Goran <goran@nospam.com> - 2012-11-15 16:09 +0100
                Re: php daemon Jerry Stuckle <jstucklex@attglobal.net> - 2012-11-15 11:25 -0500
                Re: php daemon Tim Streater <timstreater@greenbee.net> - 2012-11-15 16:20 +0000

csiph-web