PHP :: Bug #39652 :: memory_get_usage() Bug

 [2006-11-28 00:08 UTC] chris at dented-planet dot net

Description:
------------
I don't know if it's utf8_encode() or memory_get_usage() in the following script that might be causing the issue. But rather quickly in the loop, memory_get_usage() begins to report a steadily decreasing amount of memory used until it drops into negative values.

A graph of usage is at: http://dented-planet.net/graph.png

'memory_limit' is set to 100MB in php.ini.

I know this isn't the best possible bug report, but I'm not sure how else to report it.



Reproduce code:
---------------
<?php

$x = '';

for ($i = 1; $i <= 20000; $i++) { 

    $x = utf8_encode('this is a test');

    if ($i % 100 === 0) {
        echo $i . ' ' . memory_get_usage() . ' ' . memory_get_usage(true) . "\n";
    }
}

?>