Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103092 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 36984 invoked from network); 13 Aug 2018 14:03:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Aug 2018 14:03:23 -0000 Authentication-Results: pb1.pair.com smtp.mail=nicolai.scheer@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nicolai.scheer@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.54 as permitted sender) X-PHP-List-Original-Sender: nicolai.scheer@gmail.com X-Host-Fingerprint: 209.85.214.54 mail-it0-f54.google.com Received: from [209.85.214.54] ([209.85.214.54:39305] helo=mail-it0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EA/FA-32660-8AF817B5 for ; Mon, 13 Aug 2018 10:03:22 -0400 Received: by mail-it0-f54.google.com with SMTP id g141-v6so14134384ita.4 for ; Mon, 13 Aug 2018 07:03:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=XaVyOd2Wj649VvZdRw/6Ysy7/AEk0sSY52sAIvrWvFw=; b=NDmtBaLBAn4HWFnB5YFz2ZMw4BD30U6lZaqGMKYXa2PkEJvDfSFpKhqokMKcLzMaFL pOlejDfOFgFQjN6MVwh6fNqWxly1Cnx7h3rbzY+gYLFoVekSmYGxtN2VIKOxTTIwsaG5 VU0/AojF0HrTCuOM3RJ774xcSyddgnPkkxsvAZlSDLcCMcmux5sKEX14bJaPCbxt9ozz hv9Jd+RQAarcJGPGwchQD7vFIkKJ5JP1e+gcfoKF8hPBWkdQyJUcTIWjRhyBi5MBLdTK 0OBO+W/xPA5nDAXN937EWl4LkhklKpR72040KF0ZDNa6SB4yZ8VNjDVkj38GjiCGRBZ0 ttng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XaVyOd2Wj649VvZdRw/6Ysy7/AEk0sSY52sAIvrWvFw=; b=Vq4ZHQbdyCq8jX5heMa1MXQEzT2vGlxaBwcyyxFA3QB6oVkROTwokGp1c6r+lqGAJR XpkcQtU2a5OEs4r/C3R6xbqJu8eywtjP9fzEhCXmN/Aq4rf3B0UltLeJMOKZU4O5cfS4 LLK8MT0y3YeGI6zliEH9isl4kFKAhXp9dybVFQffu+y0HbFmJzhudI+MNjUNk6Qih9bA miKX+umk+FbBUgekAc2Gp7DyULarDhhM5EQNI5xziMBMeq/hIGkoEOj9/wDqa88oWnmR StFb/BZMYtfKcNBL3FL3xbUmZzisDoT/LFTGiLfdMwrXexj/WjiWCPcvCZJRkE9/u3M0 Sk4w== X-Gm-Message-State: AOUpUlF6onT7RVKcUDbTVQMMcGoJyOUjAvYhnEE+8grbM0zc6TUNp8t5 nF9JxoXpRfWSvG0CDDTumkBYOmIV4Wz4XPpbWvQ= X-Google-Smtp-Source: AA+uWPxAUG5f6PhcbU2nfRe5651r8T2bOumtoUszJ96H/AOg5xTBB+iPNultxlbuv9zCyMILRQWz7UscihBbqLsPMGg= X-Received: by 2002:a24:b211:: with SMTP id u17-v6mr10704631ite.1.1534168997314; Mon, 13 Aug 2018 07:03:17 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 13 Aug 2018 16:03:06 +0200 Message-ID: To: nikita.ppv@gmail.com Cc: PHP Internals Content-Type: multipart/alternative; boundary="0000000000001c465a0573518ecf" Subject: Re: [PHP-DEV] object destruction php 5.6 vs. 7.2 From: nicolai.scheer@gmail.com (Nicolai Scheer) --0000000000001c465a0573518ecf Content-Type: text/plain; charset="UTF-8" Hi Nikita, On Sat, 11 Aug 2018 at 11:03, Nikita Popov wrote: > On Wed, Aug 8, 2018 at 11:09 PM, Nicolai Scheer > wrote: > >> [resource destructor does not get called until shutdown] > > > My guess would be some kind of refcounting issue. For example > zend_update_property will already increment the refcount of the assigned > value itself. So if you create a value with refcount 1 and then assign it > to an object property, you likely need to do an explicit delref. If you > don't, then the value is leaked and your resource destructor will not run > until shutdown. > > Yes, you're absolutely right. I switched from: zval *rsrc = NULL; rsrc = zend_list_insert( conn_data, le_wmqe_connection_rc ); zend_update_property( php_wmqe_connection_entry, getThis(), "connection", sizeof( "connection" ) - 1, rsrc ); to: zend_resource *rsrc = NULL; rsrc = zend_register_resource( conn_data, le_wmqe_connection_rc ); add_property_resource( getThis(), "connection", rsrc ); Now the refcounting seems to be appropriate and the resource dtor gets called on object destruction. I guess it would be better to leave resources all alone and switch to custom object storage for that matter... Thanks! Greetings Nico --0000000000001c465a0573518ecf--