Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100788 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93467 invoked from network); 27 Sep 2017 17:58:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Sep 2017 17:58:17 -0000 Authentication-Results: pb1.pair.com smtp.mail=sid.kshatriya@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=sid.kshatriya@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.65 as permitted sender) X-PHP-List-Original-Sender: sid.kshatriya@gmail.com X-Host-Fingerprint: 209.85.214.65 mail-it0-f65.google.com Received: from [209.85.214.65] ([209.85.214.65:57068] helo=mail-it0-f65.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9D/36-34114-7B6EBC95 for ; Wed, 27 Sep 2017 13:58:16 -0400 Received: by mail-it0-f65.google.com with SMTP id g18so7548608itg.5 for ; Wed, 27 Sep 2017 10:58:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=Rp5IWdf+13JFjRB9bjYTR/qsksWeckkmuJnALqDddQI=; b=EFysSHk3RYNZTv1aDMBdPW2P0oUnx9nZhWn/vmAR2USGVUhQOn2jScfPa8Q+VdvzNa MlwkwauGOqssJZCYTwwlVybDqc+cbkAiUbPU0Jr70V3KvuWutUQ3vHG9Ufgz1UTnMOL4 TH3z344vYdX8oBJ47ErQNapuSCt8TVlyYDxLGnOhNvmUqukZT3f1mk6XbSsGCz/i09a9 MyyQtwdttZ4Nd8TrCESQ1aKf1wN963gGN+xH+V5CIBTjR/IINrVgMUUmJc1I7MTfo2pe Wsp9YCKX+VDcZtpQ3QEu0OSvmAWlf3B2uNh86seOwBYLPuULg1fwUdsDYvB6CqkpeudP oWsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Rp5IWdf+13JFjRB9bjYTR/qsksWeckkmuJnALqDddQI=; b=PU2UsDsw0JOuh+nu0rKow1raSMz0cI5l7zDhHSYeYk/GAcuOZOTftJZWjlVLLGCcBe ycHqxaldxsLiFUjRG7d2pElKSDqqEYRMK5hx9G8HhXyNRGeYkxm3TrncvXycxb80mgtk YS7poO4DHLg/nvWX96AS1/Dvbsvsy991Y29UKL8fKpuB+Q3EO44v1tRKsYxcP6u0o/NX HpSVayS5AY8RdlCp0SoJ4JhFCnYmamppOwr57s4+B15gU2anUCiT5H1QTxcrHrqwoVL0 zyj1GHLKGZxADebwCwXf+Rh5efFJSrYl6fi8RX5Vi+0juqyKNKQ+3Ayg2SWbTbzoq+nt wOcA== X-Gm-Message-State: AHPjjUgPYtmgmQFwT2njO3A3cf+IYtexz8iRC77wDXf1zAmdAkY+uA7i ee7JXDgiafrLg6CTR6Ml2NppB/epXLDQRctvu+MIvmYg X-Google-Smtp-Source: AOwi7QB4/9jiM3poFtqdIUJOwCY6aO3o2CCW1sflDkyNA3KbfyvTKPKfwdSXxquw5HXdjg0UIuGflzy5mwz6DlVXvCc= X-Received: by 10.36.55.4 with SMTP id r4mr1983450itr.55.1506535092679; Wed, 27 Sep 2017 10:58:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.101.70 with HTTP; Wed, 27 Sep 2017 10:57:52 -0700 (PDT) Date: Wed, 27 Sep 2017 23:27:52 +0530 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary="001a1140cda20a7912055a2f8988" Subject: Is reference counting necessary for a PHP implementation? From: sid.kshatriya@gmail.com (Sidharth Kshatriya) --001a1140cda20a7912055a2f8988 Content-Type: text/plain; charset="UTF-8" In: https://github.com/php/php-langspec/blob/master/spec/04-basic-concepts.md#reclamation-and-automatic-memory-management > Despite the use of the term refcount, conforming implementations are not required to use a reference counting-based implementation for automatic memory management. Is this statement correct? If I understand correctly many PHP projects depend on the deterministic firing of `__destruct()` function to cleanup SQL transactions or connections and so forth. HHVM elaborates on this: > Eliminating destructors. Deterministic object destruction is the reason why nonscalar PHP values require precise reference counting. This requirement has long been, and continues to be, a sizable performance bottleneck in our optimized JIT-compiled code. Using garbage collection instead could unlock measurable performance improvements, and the behavior of destructors could be closely imitated by a combination of try/finally and other new language constructs. (from http://hhvm.com/blog/2017/09/18/the-future-of-hhvm.html ) I'm curious about the answer here. Is ref counting necessary for all PHP implementations like HHVM claims? Thanks, Sidharth --001a1140cda20a7912055a2f8988--