ID:               41911
 Updated by:       [EMAIL PROTECTED]
 Reported By:      irb at redwoodtech dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Date/time related
 Operating System: Windows XP SP2
 PHP Version:      5.2.3
 New Comment:

All memory leaks are reported by the engine, this is the way the engine
works and it is perfectly acceptable.


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

[2007-07-06 06:06:02] irb at redwoodtech dot com

Description:
------------
If a time string is to be read from a SimpleXML object and converted
into a unix timestamp then a memory leak occurs if the SimpleXML object
is passed directly to strtotime.

The memory leak can be stopped by type casting before passing the
string to strtotime. For example, change the relevant line in the
reproduce code to:

$lTime = strtotime ((string) $xml['timestamp']);

Reproduce code:
---------------
while(true)
{
        $xml = new SimpleXMLElement('<test timestamp="Thu, 5 Jul 2007 16:51:23
GMT"></test>');
        echo 'Current Daemon Memory Usage is ' . memory_get_usage ( ) ." bytes
: Before STRTOTIME\n";
        $lTime = strtotime ($xml['timestamp']);
        echo 'Current Daemon Memory Usage is ' . memory_get_usage ( ) ." bytes
: After STRTOTIME\n";
}

Expected result:
----------------
The following is expected. The point being that the memory usage of the
application is constant.

Current Daemon Memory Usage is 53720 bytes : Before STRTOTIME
Current Daemon Memory Usage is 53720 bytes : After STRTOTIME
Current Daemon Memory Usage is 53720 bytes : Before STRTOTIME
Current Daemon Memory Usage is 53720 bytes : After STRTOTIME
Current Daemon Memory Usage is 53720 bytes : Before STRTOTIME
Current Daemon Memory Usage is 53720 bytes : After STRTOTIME

Actual result:
--------------
Memory usage increases over time.

Current Daemon Memory Usage is ___94240 bytes : After STRTOTIME
Current Daemon Memory Usage is ___94400 bytes : Before STRTOTIME
Current Daemon Memory Usage is ___94440 bytes : After STRTOTIME
Current Daemon Memory Usage is ___94600 bytes : Before STRTOTIME
Current Daemon Memory Usage is ___94640 bytes : After STRTOTIME
Current Daemon Memory Usage is ___94800 bytes : Before STRTOTIME
Current Daemon Memory Usage is ___94840 bytes : After STRTOTIME


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


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

Reply via email to