Re: [PHP] Negative memory_get_usage() Values



Whoops,

I'm using PHP 5.2.0 on Mac OS X 10.4.8.

I'll do as you suggest (and learn more about PHP memory usage) to try to see what's going on.

Chris
chris@xxxxxxxxxxxxxxxxx



On Nov 26, 2006, at 12:34 PM, Richard Lynch wrote:

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

  • 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: Memory usage by class files
    ... discovered that when my app starts to include the class definitions it ... memory usage is TEN TIMES the size the class file occupied on the disk - ... efficient way of building the code (should I consider 'compiling' the ... PHP gets compiled into Zend Opcodes before executing. ...
    (comp.lang.php)
  • PHP 4.3.4 memory usage
    ... I'm concerned with very steep jump the PHP 4.3.4 made in memory usage ... the memory usage for PHP process was 4372 kB after running a simple ...
    (php.general)
  • Re: Problem with memory management
    ... I'm wondering why PHP doesn't free my memory with this test code. ... The memory usage is always the same even if i unset my object. ...
    (php.general)
  • Re: [PHP] Negative memory_get_usage() Values
    ... What version of PHP and what OS? ... memory_get_usage() in PHP 5 and managed memory where it would make ... I suspect that there is a bug in utf8_encodebut I'd like others to ... echo utf8_encode; ...
    (php.general)