|  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
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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: chris at dented-planet dot net
New email:
PHP Version: OS:


 [2006-11-28 00:08 UTC] chris at dented-planet dot net
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:

'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:

$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";



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-12-01 11:42 UTC]
Fixed in CVS HEAD and PHP_5_2.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sun Jan 23 15:03:35 2022 UTC