php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39652 memory_get_usage() Bug
Submitted: 2006-11-28 00:08 UTC Modified: 2006-12-01 11:42 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: chris at dented-planet dot net Assigned: dmitry (profile)
Status: Closed Package: Unknown/Other Function
PHP Version: 5.2.0 OS: Mac OS X 10.4.8
Private report: No CVE-ID: None
 [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";
    }
}

?>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-12-01 11:42 UTC] dmitry@php.net
Fixed in CVS HEAD and PHP_5_2.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 11:01:28 2024 UTC