FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » php daemon
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: php daemon [message #179623 is a reply to message #179613] Wed, 14 November 2012 20:19 Go to previous messageGo to previous message
Christoph Becker is currently offline  Christoph Becker
Messages: 91
Registered: June 2012
Karma:
Member
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?

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.

--
Christoph M. Becker
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Benefits of the 3-Tier Architecture
Next Topic: Bad database design can cause unnecessary coding
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 12:07:01 GMT 2024

Total time taken to generate the page: 0.04529 seconds