Re: [PHP] Negative memory_get_usage() Values



What version of PHP and what OS?

I *think* that there is some jiggery-pokery going on in
memory_get_usage() in PHP 5 and managed memory where it would make
perfect sense to get negative numbers occasionally...

You may also want to log the memory_get_usage inside the loop, and
then graph the memory usage as it goes up/down to get a better idea of
what's going on.

On Sun, November 26, 2006 8:35 am, Chris wrote:
Hey gang,

I'm getting a negative return value from memory_get_usage() using the
following script. My I've got --enable-memory-limit enabled and my
memory_limit is set to 100MB (which should more than enough memory).

I suspect that there is a bug in utf8_encode() but I'd like others to
test it (on different platforms) before I submit it as a bug.

<?php

for ($i=0; $i < 20000; $i++) {
echo utf8_encode('This is a test');
}

echo memory_get_usage();

?>


Chris
chris@xxxxxxxxxxxxxxxxx

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
.



Relevant Pages

  • [UNIX] PHP gd Library imageRotate() Function Information Leak Vulnerability
    ... PHP gd Library imageRotateFunction Information Leak Vulnerability ... Information leak vulnerabilities allow access to e.g. the Apache memory ... gdImagePtr gdImageRotate (gdImagePtr src, double dAngle, ... if($debug) ...
    (Securiteam)
  • Re: Apache and Tux running together
    ... my job we've got a web based product provided by Apache running PHP ... This web application is hosted by multiple servers ... out on the number of httpd processes and falls behind to the ... so I'm thinking I'm memory bound. ...
    (comp.lang.php)
  • Re: get_memory_usage() and mysql resource usage?
    ... suspect memory or resource limits in MySQL might be the problem. ... I have a set of php scripts which query the database with some pretty ... report, it take about 30-45 seconds to generate, and 5 MB of memory, ...
    (alt.php)
  • RE: [PHP] is_writable() not working on PHP 5.1.6
    ... } else echo "The file does not exist"; ... [PHP] is_writablenot working on PHP 5.1.6 ... user to apaches user. ... I have seen some bug reports on this, ...
    (php.general)
  • Re: Script mysteriously stops executing...
    ... memory leaks...that seems to be the case. ... misfortune of being on a corporate-wide PHP RPM that does not include ... more sophisticated memory management tool than the default reference ...   unset; ...
    (comp.lang.php)