From:             [EMAIL PROTECTED]
Operating system: RH8
PHP version:      5CVS-2004-02-16 (dev)
PHP Bug Type:     Zend Engine 2 problem
Bug description:  Array->String cast takes serious performance hit, leaks like crazy

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 bug report at http://bugs.php.net/?id=27275&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27275&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27275&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27275&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27275&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27275&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27275&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27275&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27275&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27275&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27275&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27275&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27275&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27275&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27275&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27275&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27275&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27275&r=float

Reply via email to