php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46075 repeated calls of strftime() consumes memory
Submitted: 2008-09-14 12:12 UTC Modified: 2009-03-04 10:35 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: acc_php at riggers dot me dot uk Assigned: pajoye (profile)
Status: Closed Package: Date/time related
PHP Version: 5.2CVS-2008-09-15 OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: acc_php at riggers dot me dot uk
New email:
PHP Version: OS:

 

 [2008-09-14 12:12 UTC] 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>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-09-15 19:10 UTC] 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-12-18 14:57 UTC] pajoye@php.net
please try the next 5.3/HEAD snapshots (could be related to #46889).
 [2008-12-18 14:58 UTC] pajoye@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2009-01-04 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2009-03-04 10:35 UTC] pajoye@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jun 02 18:01:26 2025 UTC