ID:               41911
 User updated by:  irb at redwoodtech dot com
 Reported By:      irb at redwoodtech dot com
 Status:           Bogus
 Bug Type:         Date/time related
 Operating System: Windows XP SP2
 PHP Version:      5.2.3
 New Comment:

Tony, thanks for the quick response.

The messages being logged are generated by my own debug code (See the
echo statements in the reproduce code). Unless I've misunderstood your
comment, you've mistaken my debug messages for the memory leak alerts
raised by the engine.

I didn't mean for the issue raised to be the way in which the memory
leak is reported but rather the memory leak itself.

I asked someone on irc.freenode.net#php to double check my reasoning
and they told me that this looks bogus but for a different reason - that
PHP isn't designed for long-term processes. Is that right?

Any clarification you could provide would be very much appreciated.


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

[2007-07-06 09:20:22] [EMAIL PROTECTED]

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

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

[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