Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94998 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 90534 invoked from network); 10 Aug 2016 10:59:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Aug 2016 10:59:15 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.180 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.161.180 mail-yw0-f180.google.com Received: from [209.85.161.180] ([209.85.161.180:34077] helo=mail-yw0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4E/63-08042-2090BA75 for ; Wed, 10 Aug 2016 06:59:14 -0400 Received: by mail-yw0-f180.google.com with SMTP id z8so23074241ywa.1 for ; Wed, 10 Aug 2016 03:59:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=p6zLDTF0rSXQYJ/6Bp4IujX/txhv1GXrw760NxOtWAw=; b=DqkXxNezmW3p15Nxo9mvTxCnin1+Mr3AQXY3VzDw01Ljpsw9pWtCO+KmHLPTDAMpjG o8PAGGOgeVZplVADcUy+sutleoDp6bwwStIQvxrULJgLWqV+tkc8JwHCTsKs58qn6cUg FUz3azu0sk6R/7whwJ3rhykVn5UxuO/Zc2Ca598krV/nISeV9pqXEQcYaahOwyOtkN+H GHd4tHuAjmYRmwtpc6JRJ6Ha4udfslOHSm+2rFoFQvDEfGBZHkWY8AhN7ZRx1E5FemKJ vSFyXPcEs459IP+64YvyLdhxFB9Lws0sHe5AjKDiHuFGIupV3YHwXM8JOFAc4u6dbemt o2YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=p6zLDTF0rSXQYJ/6Bp4IujX/txhv1GXrw760NxOtWAw=; b=NFfVzIuxSGz2bRaVnnNfoEEqd4ZsXgeUsFXYXBb5xk6TyrE6W/Cx3RhW42BXLrysg3 Lyk0/006zKf0/iiajbobKktjrsbPc2wcB9/l9gWbch33WvWFglcwZeoq6ztleylj5NaT WiDuvmXE1RBzRwmhgbQA/YF6W8qMj7FF9VkTF7Fpbf45DM3hP1SeluLaDKlpuBcL9h3p l9P7TuVSdfo4yS4Ivo05Bwr6B8AhmI90TLq8JDlWZ5gTlJis9yj8E6gMTOBbsnjM58Ho w2kr6nqL3Tz6aCTHhASdzVE+vY+RUOchs9YFL51nb1J0FizNVvX0J9yesijGQ1lfgCiw G1Cw== X-Gm-Message-State: AEkoousEThMkXEARvL3/n4YV8cLrjSpjZxQWjUBWma+yWW8mq2iNO2NMYf3e9XJe19IMBa/EXr+VJVahK8J91Q== X-Received: by 10.13.209.129 with SMTP id t123mr2221701ywd.93.1470826751026; Wed, 10 Aug 2016 03:59:11 -0700 (PDT) MIME-Version: 1.0 Received: by 10.129.131.129 with HTTP; Wed, 10 Aug 2016 03:59:10 -0700 (PDT) In-Reply-To: References: Date: Wed, 10 Aug 2016 12:59:10 +0200 Message-ID: To: "Christoph M. Becker" Cc: PHP Internals List Content-Type: multipart/alternative; boundary=001a114e8ac60569ef0539b58a4c Subject: Re: [PHP-DEV] GC issue wrt. to resource <-> object cycles? From: nikita.ppv@gmail.com (Nikita Popov) --001a114e8ac60569ef0539b58a4c Content-Type: text/plain; charset=UTF-8 On Wed, Aug 10, 2016 at 12:52 PM, Christoph M. Becker wrote: > Hi! > > I've tried to fix , and it looks like > there's a general GC issue wrt. to resources referencing objects and > vice versa. Aren't resource ZVALS put in the root buffer? > > See , which demonstrates the issue better than > the test script in the bug report. A steady increase of allocated > memory can be seen, even though gc_collect_cycles() is called. When > uncommenting `unset($this->parser);`, everything is fine (the GC > wouldn't be involved at all in this case). > > Wrt. to the PHP 5.6 behavior: this appears fine, but actually it's in > error, because of . Not > increasing the refcount of `parser->object` might theoretically lead to > use-after-free scenarios. > As you correctly deduced, we currently do not support GC for resources. This would require introducing something akin to the get_gc handler for resources. The simplest way to fix ext/xml in particular is probably to migrate it to use an object instead of a resource. Nikita --001a114e8ac60569ef0539b58a4c--