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

From: Date: Fri, 15 Jun 2007 01:21:24 +0000
Subject: #40122 [Opn->Csd]: Variable parsing eats up memory
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969376695@lists.php.net to get a copy of this message
ID: 40122 Updated by: gwynne@php.net Reported By: spheroid@php.net -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: Mac OS X 10.4.8 PHP Version: 5.2.1RC2 New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. Previous Comments: ------------------------------------------------------------------------ [2007-01-14 22:12:36] spheroid@php.net 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. ------------------------------------------------------------------------ [2007-01-14 15:03:04] iliaa@php.net The first loop creates temp vars and those are not freed until the script finished execution. ------------------------------------------------------------------------ [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.doc (#969376695) next »