Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65627 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6179 invoked from network); 4 Feb 2013 10:59:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Feb 2013 10:59:31 -0000 Authentication-Results: pb1.pair.com smtp.mail=keisial@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=keisial@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.175 as permitted sender) X-PHP-List-Original-Sender: keisial@gmail.com X-Host-Fingerprint: 74.125.82.175 mail-we0-f175.google.com Received: from [74.125.82.175] ([74.125.82.175:54469] helo=mail-we0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 54/F4-14611-1949F015 for ; Mon, 04 Feb 2013 05:59:30 -0500 Received: by mail-we0-f175.google.com with SMTP id x8so4765850wey.34 for ; Mon, 04 Feb 2013 02:59:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=GoJUuA1V/xcUdkUn6l+jJ2fT8g3V8xU3vzE5I9FfbWM=; b=0DnZJBF3odRiN/+ysmvxUJVwqG4qOYO64zcUzYimUmtbVszq1HGoYnwfOKFI+R6kZo FkR0kMSsT/Sqi6hnhlqG0u2ElhPWguXs8f3CcZLpLu/aI9kZmOYo06kYCOsQICSNbNuQ EmEiF0pFGFvjrUg9OAXU2m2KI3y5cq7NYJctLwd+9wvh/KaY/D9PCBt44hwA9dZ5vKM8 39C8c+zU7we4BlMnl7vHKZ9ZkATDuyeuWTslSSHPdwYfiwgmqQJBXcu7b2O0iWo2yPrf W9Ti2W2I5qOFlrr999ie18CnfLsM9rQCa3RSWsmi+uEIOcircxlszY1HWSN/Z0pusjgN Hnwg== X-Received: by 10.180.86.36 with SMTP id m4mr9548220wiz.5.1359975566560; Mon, 04 Feb 2013 02:59:26 -0800 (PST) Received: from [192.168.1.26] (171.red-80-28-64.adsl.dynamic.ccgg.telefonica.net. [80.28.64.171]) by mx.google.com with ESMTPS id cu7sm2915558wib.8.2013.02.04.02.59.24 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 04 Feb 2013 02:59:25 -0800 (PST) Message-ID: <510F941F.4090309@gmail.com> Date: Mon, 04 Feb 2013 11:57:35 +0100 User-Agent: Thunderbird MIME-Version: 1.0 To: =?UTF-8?B?SGFucy1Kw7xyZ2VuIFBldHJpY2g=?= CC: Terry Ellison , internals@lists.php.net References: <510E9031.9040209@gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] (non)growing memory while creating anoymous functions via eval() From: keisial@gmail.com (=?UTF-8?B?w4FuZ2VsIEdvbnrDoWxleg==?=) Hans-Jürgen Petrich wrote: > Hi Terry and all > thank you very much for your response. > >> The only thing that confused me about what you say that the second >> *doesn't* grow > Yes, about that i was [and am still :-)] also confused... why the 2nd > one won't grow *non-stop* > >> so I checked and it does -- just the same as the first. > Right, it grows, but not non-stop as in the 1st one. > > The memory will stop growing (on my machine) at ~2491584 bytes and the > loop is able to run forever, > creating each eval() furthermore uniqe ano-function's but not > endless-filling Zend-internal tables. > >> but this still leaves the function record itself in the >> function_table hash so with a non-zero reference count and this >> doesn't get DTORed until request shutdown > Not familar with the Zend-internals but just about so i was imaging > and expecting it. > > That why i [still] also confused/wondering why in the 2nd example the > memory will not grow *endless*. > It seems that the function records in the function_table will be > DTORed (or similar cleaned up) before request-shutdown at some point... > > Could this be the case? As you are reassigning $ano_fnc, the old closure is being destructed. Had you used create_function(), it wouldn't happen. Now the question is, if it is correctly freeing the functions (and it is good that it does so), why is it not doing it when they have different lengths?