#40122 [Opn->Bgs]: Variable parsing eats up memory

From: Date: Sun, 14 Jan 2007 15:03:05 +0000
Subject: #40122 [Opn->Bgs]: Variable parsing eats up memory
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-107582@lists.php.net to get a copy of this message
ID: 40122 Updated by: iliaa@php.net Reported By: spheroid@php.net -Status: Open +Status: Bogus Bug Type: Strings related Operating System: Mac OS X 10.4.8 PHP Version: 5.2.1RC2 New Comment: The first loop creates temp vars and those are not freed until the script finished execution. Previous Comments: ------------------------------------------------------------------------ [2007-01-13 18:33:52] spheroid@php.net 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

« previous php.bugs (#107582) next »