Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64392 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75179 invoked from network); 20 Dec 2012 23:33:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Dec 2012 23:33:44 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain zend.com does not designate 209.85.219.46 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.219.46 mail-oa0-f46.google.com Received: from [209.85.219.46] ([209.85.219.46:42312] helo=mail-oa0-f46.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BB/DE-20281-750A3D05 for ; Thu, 20 Dec 2012 18:33:44 -0500 Received: by mail-oa0-f46.google.com with SMTP id h16so4048237oag.5 for ; Thu, 20 Dec 2012 15:33:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-gm-message-state; bh=dCxGLCa86ze5Lr7XW0cjCbYrdga8rjFZTugC5iAZyzs=; b=Q3AX/001ZcLlNsMhygtsEJYvyNf406mlnfmDXjg/o2+mx7J6n4mOeQlDdzufzdQ8/T gZH0Kw6sYRDnRAkXU6vh6W7I0f+5vf8+M4VxuKTHBTBZF7y6bHcu6WYOL1FEbLQwa8k7 /1LnieveXbui/HzMGZ2nUufx551DIpE7PudFa4vDpPIFWyZj1GvG/12DepbCryx3jbge LxZlknF8g9almGvWM/8ZT2b5VJWH6GzXec5RX4v3YnTV3wiew78t3yMjSA6FXpDVM9E3 TvVRVuFT3tT6rJJOx3cjAUX1jHK6UnwZCUFEhBfGgw3DVo1jzmuBKFsQBir87iLEHxbn jCvg== MIME-Version: 1.0 Received: by 10.60.171.170 with SMTP id av10mr9746281oec.78.1356046421456; Thu, 20 Dec 2012 15:33:41 -0800 (PST) Received: by 10.182.214.106 with HTTP; Thu, 20 Dec 2012 15:33:41 -0800 (PST) In-Reply-To: <50D34512.1040708@lerdorf.com> References: <50D210F9.8050707@lerdorf.com> <50D34512.1040708@lerdorf.com> Date: Fri, 21 Dec 2012 02:33:41 +0300 Message-ID: To: Rasmus Lerdorf Cc: Pierre Joye , PHP Internals Content-Type: multipart/alternative; boundary=bcaec54a33903ff68104d15129eb X-Gm-Message-State: ALoCoQlirrYcwn2YoLXDQODATE3Ou6hc1LH2ZC9Zl+fEri3ozxo8Wy0CfzZ6gS9B46Y0fPfke4D+K8tUQjTp4TtpHjejT7TTv9ADV7wotaRIjjKcdAkINhzaBFHg0bLWT8b84iXWRtEl Subject: Re: [PHP-DEV] Complete traits redesign for 5.5 From: dmitry@zend.com (Dmitry Stogov) --bcaec54a33903ff68104d15129eb Content-Type: text/plain; charset=UTF-8 hi Rasmus, I don't know all the APC internals, but it seems it just doesn't free memory carefully. It sets zend_class_entry->refcount to something above 1000 and as result all the nested structures are not freed as expected by destroy_zend_class(). I'm not sure which side effects this may have, but one of them is avoiding of the trait related problem :) Of course, It produces many memory leaks but most of them (probably all) must be handled by zend_alloc $ PHP_FCGI_MAX_REQUESTS=2 USE_ZEND_ALLOC=0 valgrind sapi/cgi/php-cgi -b /tmp/fcgi-php5 ... ==30930== definitely lost: 676 bytes in 10 blocks ==30930== indirectly lost: 1,213 bytes in 24 blocks ... ~2K memory leaks on 2 HTTP requests (the same trait.php test) It also must change the destruction order of static members and methods static variables, but I'm too lazy to prove it. Anyway, the traits problem really exists and I almost found a solution for 5.4 without BC break. I'll post a patch tomorrow or on next week. Thanks. Dmitry. On Thu, Dec 20, 2012 at 9:04 PM, Rasmus Lerdorf wrote: > On 12/20/2012 06:36 AM, Dmitry Stogov wrote: > > Hi Pierre, > > > > The following test may crash on the second request with opcode cache. > > > > > > > trait THello { > > > > public function hello() { echo 'Hello'; } > > } > > > > class TraitsTest { use THello; } > > > > $test = new TraitsTest(); > > $test->hello(); > > > > ?> > > > > Valgrind shows the problem even if PHP doesn't crash. > > I'm not seeing anything from Valgrind's memcheck on this under php -S > with current PHP 5.4 and APC. Testing on 64-bit Linux. > > -Rasmus > > --bcaec54a33903ff68104d15129eb--