ID:               40122
 User updated by:  [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Bogus
+Status:           Open
-Bug Type:         Strings related
+Bug Type:         Documentation problem
 Operating System: Mac OS X 10.4.8
 PHP Version:      5.2.1RC2
 New Comment:

So if one should write a daemon or anything else with a bit 
longer life span and/or heavy I/O, she'd better avoid using 
parsed expressions inside strings?

Even though it's not a big deal, I still think it should be 
stated somewhere.


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

[2007-01-14 15:03:04] [EMAIL PROTECTED]

The first loop creates temp vars and those are not freed until the
script finished execution.

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

[2007-01-13 18:33:52] [EMAIL PROTECTED]

Description:
------------
I'm not sure whether this is intended behaviour, but variable 
parsing inside strings seem to allocate memory, which is not 
freed until script has been executed.

Reproduce code:
---------------
$foo = 'value';
echo "first loop\n";

for ($i = 0; $i < 10; $i++) {
    $bar = "foo: $foo";
    echo memory_get_usage() . "\n";
}

echo "second loop\n";

for ($i = 0; $i < 10; $i++) {
    $bar = 'foo: ' . $foo;
    echo memory_get_usage() . "\n";
}

Expected result:
----------------
first loop
52280
52280
...
52280
52280
second loop
52516
52516
...
52516
52516

Actual result:
--------------
first loop
52280
52304
52328
52352
52376
52400
52424
52448
52472
52496
second loop
52516
52516
...
52516
52516



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


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

Reply via email to