ID:               45047
 Comment by:       crrodriguez at suse dot de
 Reported By:      lars_teuber at gmx dot de
 Status:           Open
 Bug Type:         Reproducible crash
 Operating System: linux
 PHP Version:      5.2.6
 New Comment:

Do not file bugs when you have Zend extensions (zend_extension=)
loaded. Examples are Zend Optimizer, Zend Debugger, Turck MM Cache,
APC, Xdebug and ionCube loader.  These extensions often modify engine
behavior which is not related to PHP itself.


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

[2008-05-20 08:38:50] lars_teuber at gmx dot de

Description:
------------
memory leak with array as default function parameter in encoded code

- code encoded by Zend Guard 5.0.1
- tested on linux, apache with php 5.2.5 and php 5.2.6
- not reproducible under Windows (IIS, php 5.2.6 or Apache, php 5.2.5)
- not reproducible with unencoded code
- memory leak occurs only under linux with Zend encoded code

Reproduce code:
---------------
<?php
$max = 1000000;

// this leaks if the code is encoded
$start_mem = memory_get_usage(true);
for ($i = 0; $i < $max; $i++) {
    leak();
}
echo 'leak mem1: [' . (memory_get_usage(true) - $start_mem) .
"]\n<br>";

// this does not leak
$start_mem = memory_get_usage(true);
for ($i = 0; $i < $max; $i++) {
    leak(array($i));
}
echo 'leak mem2: [' . (memory_get_usage(true) - $start_mem) . ']';

function leak($leak = array()) {}
?>

Expected result:
----------------
leak mem1: [0]
leak mem2: [0]

Actual result:
--------------
leak mem1: [87818240]
leak mem2: [0] 


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


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

Reply via email to