Bug #66091 [NEW]: Memory leak in DateTime::createFromFormat()
| From: | lars_teuber at gmx dot de | Date: | Wed, 13 Nov 2013 17:01:08 +0000 |
| Subject: | Bug #66091 [NEW]: Memory leak in DateTime::createFromFormat() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-182742@lists.php.net to get a copy of this message | ||
From: lars_teuber at gmx dot de
Operating system: Windows/Linux
PHP version: Irrelevant
Package: Unknown/Other Function
Bug Type: Bug
Bug description:Memory leak in DateTime::createFromFormat()
Description:
------------
Hi,
DateTime::createFromFormat() has a memory leak.
Tested with: 5.3.14, 5.4.4, 5.5.3
Best regards
Lars Teuber
Test script:
---------------
<?php
$mem_start = memory_get_usage(true);
echo 'start: ' . $mem_start . '<br>';
$max_iterations = 1000000;
for ($i = 1; $i <= $max_iterations; $i++) {
DateTime::createFromFormat('M/D/Y H:i:s', '2013-11-12 20:00:00');
if (($i % 100000) == 0) {
echo $i . '.: ' . memory_get_usage(true) . '<br>';
}
}
$mem_end = memory_get_usage(true);
echo 'end: ' . $mem_end . '<br>';
echo 'diff end-start: ' . ($mem_end - $mem_start) . '<br>';
?>
Expected result:
----------------
(more or less) constant memory usage
Actual result:
--------------
start: 524288
100000.: 16777216
200000.: 33030144
300000.: 53477376
400000.: 65536000
500000.: 77594624
600000.: 106168320
700000.: 118226944
800000.: 130285568
900000.: 142344192
1000000.: 154140672
end: 154140672
diff end-start: 153616384
--
Edit bug report at https://bugs.php.net/bug.php?id=66091&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66091&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66091&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66091&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=66091&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=66091&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=66091&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=66091&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=66091&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=66091&r=support
Expected behavior: https://bugs.php.net/fix.php?id=66091&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=66091&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=66091&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=66091&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66091&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=66091&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=66091&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=66091&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66091&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=66091&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=66091&r=mysqlcfg