ID:               46075
 Comment by:       brian at nerdlife dot net
 Reported By:      acc_php at riggers dot me dot uk
 Status:           Open
 Bug Type:         Date/time related
 Operating System: Vista x64
 PHP Version:      5.2.6
 New Comment:

This happens for me too (PHP 5.2.6-4 with Suhosin-Patch 0.9.6.2 (cli)
(built: Sep 25 2008 01:14:32)).  strangely enough it seems to cap off at
around 6k of memory usage:

<?php
echo "=== strftime() a lot ===\n";
$start = memory_get_usage();
echo "Start: ".$start."\n";
for($i = 0; $i < 10000; $i++ ) {
    strftime("%d");
}
$end = memory_get_usage();
echo "End: ".$end."\n";
echo "Diff: ".($end-$start)."\n\n";
?>

produces 
=== strftime() a lot ===
Start: 53264
End: 118644
Diff: 65380

while increasing the number of loops 10x has identical output.  Also,
adding additional tokens (i.e. changing "%d" to "%d %d") increases the
leak, but adding spaces ("%d"=>"%d ") does not.


Previous Comments:
------------------------------------------------------------------------

[2008-09-15 19:10:39] acc_php at riggers dot me dot uk

Same problem I'm afraid:

C:\php-latest>php.exe C:\php-gtk2\andy\symftest\strftime.test.php
=== strftime() ===
Start: 59072
End: 124488

=== date() ===
Start: 124488
End: 124456

C:\php-latest>php -v
PHP 5.2.7-dev (cli) (built: Aug  6 2008 03:00:55)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies

------------------------------------------------------------------------

[2008-09-15 07:59:46] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows (zip):
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

For Windows (installer):

  http://snaps.php.net/win32/php5.2-win32-installer-latest.msi



------------------------------------------------------------------------

[2008-09-14 12:12:14] acc_php at riggers dot me dot uk

Description:
------------
strftime() called many times results in increasing memory usage. date()
is OK. This is on Vista x64. PHP 5.1.6 (only version i have at the
moment) on linux does not exhibit the same problem.

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

echo "=== strftime() ===\n";
echo "Start: ".memory_get_usage()."\n";
for($i = 0; $i < 10000; $i++ ) {
    strftime("%d");
}
echo "End: ".memory_get_usage()."\n\n";

echo "=== date() ===\n";
echo "Start: ".memory_get_usage()."\n";
for($i = 0; $i < 10000; $i++ ) {
    date("d");
}
echo "End: ".memory_get_usage()."\n";

?>

Expected result:
----------------
End memory usage for strftime() should be close to Start memory usage.

Actual result:
--------------
C:\php-gtk2>php andy\symftest\strftime.test.php
=== strftime() ===
Start: 54384
End: 119800

=== date() ===
Start: 119800
End: 119768

C:\php-gtk2>php -v
PHP 5.2.6 (cli) (built: May  2 2008 19:37:32)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

C:\php-gtk2>


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=46075&edit=1

Reply via email to