ID:               46889
 Updated by:       j...@php.net
 Reported By:      tim at digicol dot de
-Status:           Assigned
+Status:           Closed
 Bug Type:         Date/time related
 Operating System: *
 PHP Version:      5.2.8
 Assigned To:      derick


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

[2009-06-26 08:14:21] strucken at web dot de

Without using the second parameter of strtotime the memory leak is
fixed. But memory usage is still increasing when I execute the following
under windows (reproduces with 5.2.8, 5.2.9 and 5.2.10 under windows xp
and windows server 2003) until I reach the 2 GB limit of my windows
32bit:

for( $i = 1; ; $i++ )
    strtotime( '+1 week', $i );

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

[2008-12-19 14:11:36] tim at digicol dot de

I have verified that this bug is fixed in the PHP snapshot  php5.2-
200812191130.tar.bz2. Thanks a lot!

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

[2008-12-18 14:57:03] der...@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.



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

[2008-12-18 11:12:33] martin at 925 dot dk

Reproduced here.

OS:
FreeBSD 7.0-RELEASE-p4 FreeBSD 7.0-RELEASE-p4

PHP:
PHP 5.2.8 (cli) (built: Dec  8 2008 19:11:49) 
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies

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

[2008-12-17 15:11:48] tim at digicol dot de

Description:
------------
With PHP 5.2.8, strtotime() on my Linux box leaks memory; we've 
noticed it because we're using long-running scripts with the PHP CLI. 
In our case, the PHP processes grew to hundreds of MB RAM usage within

minutes. This is not the case with PHP 5.2.6.

The funny thing is that neither memory_get_usage(false) nor 
memory_get_usage(true) report the actual memory usage; here's a line 
from top:

22728 digicol   25   0  258m 218m 6928 R 75.4 43.4   0:42.91 php

... while the PHP functions report at the same time:

memory_get_usage(false): 1738020
memory_get_usage(true):  1835008

What's also funny is that the default "memory_limit = 128M" setting 
doesn't help: PHP doesn't notice that this much RAM is being 
used and so doesn't kill the script. (But I can trigger the memory 
limit as usual with other PHP scripts, so PHP's memory limit isn't 
entirely broken.)

I tested with an unchanged copy of php.ini-recommended.

My configure string:

'./configure'  '--with-apxs2=/usr/bin/apxs2' '--enable-exif' '--
enable-ftp' '--enable-mbregex' '--enable-mbstring=all' '--enable-
pcntl' '--enable-soap' '--enable-zip' '--with-zlib' '--with-curl' '--
with-freetype-dir=/usr' '--with-gd' '--with-jpeg-dir=/usr' '--with-
ldap' '--with-mysqli' '--with-
oci8=instantclient,/usr/local/lib/instantclient' '--enable-sigchild' 
'--with-png-dir=/usr' '--with-xsl' '--with-mcrypt'

This is Debian Linux 4.0, running in VMware Fusion on an Intel Mac.

Thanks a lot for looking into this, and for the great work on PHP!

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

// Run with the PHP CLI on the Linux shell...
// WARNING: If this bug affects you as well, your machine
// might start swapping within just a few seconds!

while (true)
    strtotime('2008-12-16 19:48:27');

?>


Expected result:
----------------
No increase in memory usage.

Actual result:
--------------
Memory usage is increasing dramatically - on my box, the process is 
growing by 100 MB per second...


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


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

Reply via email to