#27275 [Ver->Csd]: Array->String cast takes serious performance hit, leaks like crazy

From: Date: Mon, 15 Mar 2004 15:12:53 +0000
Subject: #27275 [Ver->Csd]: Array->String cast takes serious performance hit, leaks like crazy
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-56494@lists.php.net to get a copy of this message
ID: 27275 Updated by: sniper@php.net Reported By: john@php.net -Status: Verified +Status: Closed Bug Type: Performance problem Operating System: * PHP Version: 5CVS-2004-02-16 (4CVS) New Comment: Apparently fixed in CVS now. Previous Comments: ------------------------------------------------------------------------ [2004-02-16 11:18:05] sniper@php.net This happens with PHP 4 too, so it's nothing new.. ------------------------------------------------------------------------ [2004-02-16 07:38:48] john@php.net Description: ------------ It appears that the engine is doing a Copy-on-write when it shouldn't be because the variable is being cast to something else. If that is correct (that might not be the correct bug diagnosis), Not only does this slow everything down since you are doing deep copies when you don't need to be but it leaks like crazy. Reproduce code: --------------- <?php $a = array(1, 2, 3, 4, 5, 6); $b = $a; $b .= "foo"; ?> Expected result: ---------------- Nothing. Actual result: -------------- /home/john/working/php-src/Zend/zend_hash.c(756) : Freeing 0x4045DCB8 (35 bytes), script=array.php /home/john/working/php-src/Zend/zend_hash.c(377) : Actual location (location was relayed) Last leak repeated 5 times /home/john/working/php-src/Zend/zend_execute.c(1718) : Freeing 0x4045DA70 (44 bytes), script=array.php /home/john/working/php-src/Zend/zend_variables.c(148) : Actual location (location was relayed) /home/john/working/php-src/Zend/zend_execute.c(3313) : Freeing 0x4045D878 (16 bytes), script=array.php Last leak repeated 5 times /home/john/working/php-src/Zend/zend_variables.c(149) : Freeing 0x4045E638 (32 bytes), script=array.php /home/john/working/php-src/Zend/zend_hash.c(157) : Actual location (location was relayed) === Total 14 memory leaks detected === ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=27275&edit=1

« previous php.bugs (#56494) next »