|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-05-21 22:10 UTC] crrodriguez at suse dot de
[2008-05-21 22:15 UTC] felipe@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 24 20:00:01 2025 UTC |
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]