ID:               40172
 Comment by:       travis at pause dot ca
 Reported By:      diogo86 at gmail dot com
 Status:           No Feedback
 Bug Type:         Performance problem
 Operating System: Debian
 PHP Version:      5.2.0
 New Comment:

I'm experiencing the same issue: date() increases memory usage (for us)
by about 17-20kb each time it's called. We're running Redhat Enterprise
on our server with PHP 5.2.4. We've also experienced the problem on
Windows XP with PHP 5.2.3.

Interestingly gmdate() is not affected by the issue, leading me to
think it was a problem related somehow to the timezone file.

After a little investigation in that direction we found a fix. Simply
specify date.timezone in your php.ini file and no more memory leak for
date(). 

eg:
date.timezone = America/Toronto

So this bug can be replicated, it does exist (at least in the versions
mentioned above), but there is a workaround until the leak is fixed (if
it hasn't been in CVS already).

Cheers!


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

[2007-01-27 01:00:00] 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".

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

[2007-01-19 17:03:48] [EMAIL PROTECTED]

Please try using this CVS snapshot:

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

Cannot reproduce.

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

[2007-01-19 16:52:52] diogo86 at gmail dot com

Description:
------------
The date() function keep consuming memory each time it's called even if
it's not assigned to any variable.

Reproduce code:
---------------
<?php
for($i=0; $i<10000; $i++)
   date('d/m/Y H:i:s');

echo memory_get_usage();
?>

Expected result:
----------------
Something about 46436 bytes of memory usage just like when I call this
statement inside that loop:

$str = strtoupper($_SERVER['PHP_SELF']);

Actual result:
--------------
5485532 bytes of memory usage.


----
Debian Linux 2.6.15-1-486

PHP 5.2.0-8 (cli) (built: Dec 17 2006 20:03:51)

[PHP Modules]
bcmath
bz2
calendar
ctype
date
dba
dom
exif
filter
ftp
gettext
hash
iconv
json
libxml
mbstring
mime_magic
ncurses
openssl
pcntl
pcre
PDO
pdo_pgsql
posix
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
zip
zlib

[Zend Modules]



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


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

Reply via email to