ID:               46889
 Comment by:       martin at 925 dot dk
 Reported By:      tim at digicol dot de
 Status:           Assigned
 Bug Type:         Date/time related
 Operating System: *
 PHP Version:      5.2.8
 Assigned To:      derick
 New Comment:

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


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

[2008-12-17 16:55:59] php at degoulet dot net

same issue on centos

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

[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