#38591 [Fbk->Opn]: Memory Leak when using pathinfo and DirectoryIterator __toString
| From: | rr at d2g dot org dot uk | Date: | Tue, 29 Aug 2006 12:04:58 +0000 |
| Subject: | #38591 [Fbk->Opn]: Memory Leak when using pathinfo and DirectoryIterator __toString | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-101483@lists.php.net to get a copy of this message | ||
ID: 38591
User updated by: rr at d2g dot org dot uk
Reported By: rr at d2g dot org dot uk
-Status: Feedback
+Status: Open
Bug Type: *Directory/Filesystem functions
Operating System: win XP
PHP Version: 5.1.5
New Comment:
Every time the loop is executed the memory used by php increases by
approx 4k. This happens even though everything is unset. So every loop
the memory usage should return to the minimum amount but this doesn't
happen the memory usage continues to increase.
To view the error, load windows taskman and view the memory usage of
php when running this code. You should see it slowly increasing.
Previous Comments:
------------------------------------------------------------------------
[2006-08-29 10:08:02] tony2001@php.net
What do you mean by "memory leak" ?
------------------------------------------------------------------------
[2006-08-29 07:03:59] rr at d2g dot org dot uk
Still present when using CSV snapshot.
------------------------------------------------------------------------
[2006-08-25 21:35:42] tony2001@php.net
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
------------------------------------------------------------------------
[2006-08-25 15:19:24] rr at d2g dot org dot uk
Description:
------------
When running the code below on PHP version 5.1.6. On what seems to be
any directory with files in, have tested with my C:/ and C:/folder/.
The code below is run from the Command Line to recreate the issue.
This is only present when using __toString rather than ->getFileName()
or ->getPathName functions of DirectoryIterator.
A memory leak occours.
Reproduce code:
---------------
<?php
set_time_limit(0);
while(true)
{
$CurrentDir = new DirectoryIterator("C:/");
foreach($CurrentDir as $file)
{
$tmp = pathinfo($file);
print_r($tmp);
}
unset($tmp);
unset($file);
unset($CurrentDir);
sleep(1);
}
?>
Expected result:
----------------
Works.
Actual result:
--------------
Works, but has memory Leak.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38591&edit=1