Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124699 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 4D67D1A00B7 for ; Wed, 31 Jul 2024 15:52:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1722441219; bh=VaBFBF/y40nnN6EZHsdaZkW42myoH86Jb+fq/B7mklo=; h=Date:Subject:To:References:From:In-Reply-To:From; b=E496BmAgOxQnMuu8Ljz70qRs2Fy5wuBB0/ZXaXAOod0v8m0ioX5UT4PrDQK1C6XHC +2LbCgokouFTf0azmeQdkdtjEVODUjyu4y/TWCD0hM8kQ8Ddj9stfujpSI1zX5/Gec TyKWqphDLuIJot4hGeYtwmxVmDN//1XbWwB6t6uKsi/c0NdW2PM4O/f8tq7snmlQeW N2rmIv/VZi9BB0PtQoyUClfjkK7xNcs0ZyyXnwiyPidyTzWebrtyJIEsUuIQOTkaSW 8SJh1ml9f3w6aHQ25Dsey0tcsI/KHV8qRVgJ3clayvLLD7Wip7+HqwjQeKGyT0b26u DH4MPBasvbBHQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8B270180042 for ; Wed, 31 Jul 2024 15:53:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 31 Jul 2024 15:53:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1722441117; x=1723045917; i=cmbecker69@gmx.de; bh=sBfs+lpqUa0RW9mn3w9RnofPzD0uFOGbM1TEUevNjRc=; h=X-UI-Sender-Class:Message-ID:Date:MIME-Version:Subject:To: References:From:In-Reply-To:Content-Type: Content-Transfer-Encoding:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=cB/8dJ0CmyrJkLUapzohPwN2JtuNMxrahpEsmiKVu80SpuEj5t+6kLkL8xKn8l2K Fd73TMW61hrN1LwJKctkbZZEofdQBuuKYznYEaYnr0qgxmxBiKk03uoI7KN8xwl/q RCXWyQ5Mid3hfPl/G/d3DzuA9nJ/JNdQzKONN/PCIEtS47ei9o3rwMaS1Djda4r62 vVR0ardAmac59XrsoKbpWP/BFD1PYtaRJsNXZvDZhheGgzZ0sjIOzQ8DVoi3NOks8 Ya+pQ0ZYmz2/FLP7ffuTAQO7kuRmWAcz0K+TONOsZwpv2t4yp7Sjmj6GD9vJ3z2Jt 4hONU6i5lxSudePxuw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.2.130] ([79.251.205.37]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1My36N-1sKeSw0acR-012pKV; Wed, 31 Jul 2024 17:51:57 +0200 Message-ID: Date: Wed, 31 Jul 2024 17:51:56 +0200 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] User land function to get memory left to allocate To: Florian Engelhardt , PHP internals References: Content-Language: de-DE In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:WeHtsx2qtNwp6PvdcMINB5RxzdYKwvztOXywB3bq4hpvv8C/NVW LiQGVl8F2+nxA1fRjMSAFUW69lV+vNvEvAI3e+aYzoJ2XjDLcoq+x2On4K/s9FGFesZi1zr fUkQC9hK16HC1hc9SMFpAtGBTKpwgn8LnmOTqAhWmhb+vfDdnDY8ljfScaUo1bo+DK0sM8b e3Zhtv0utrWEZK/j0s8Qg== UI-OutboundReport: notjunk:1;M01:P0:vsLDKI3g2ZI=;tKWDH7esRxev8wzDlDyr7PglO+i L9sdhIaIVmpSgZe4k3Fs3wWeeJ+kcQr/V8+lmsHPWYBNOH+WkL6OmrpkMt31vrOJYz3Dnn0lY sX0THRYDsqnIMN0B4uVJFxCOamgvWoINYz2orBa5US7r8BekO7PLVNi1G2LNzRoWCzzHEg+nw FY6PAEhltyWgWYTZex/tgSgcVL36CKailRk1u+YbgntqkpaCyqE58/Qihqf2qA28Lq/HyOOgC j+tYjXTYozlRbC5NOJH9wcnMPWNWvxx2QETbeN/gfVP/veYI8hF50CqVS8Dhk2oR2LXngGGxp aZ7Zdge602edAj9dk4MlB3X12EptZeENv8WyoTKEKpCSq1LqRdC4OEkXjBcywypuJx9hSzquS rbRaB8blFBko+cQJFCx8Bt7K0KAYbh1g1F9SyVXt/x6Fi5xB2CRsf/8IjJO1IhhCrEsI/ZtCL vd6Bf71Ug9zOfjjeYWghqxf4GcFusvf0yOs23HTY4fuxeD7vzjrYiu5tqDSSgE50CoYkCYxPV JPRyL+45r9nFODP9H4p2JdDVb75Z3MCSR067o0DjtgurhYb374i2kZAqV+QRedBjEzLaemLcv +sqvkRGsT2HdBfot06vp3auDrcGutDicCvxVb3IlUgKIvamntVjt024heS/OVn7sJNMy6l5aV CHqMazNkgHgKh7G3gyxkmBgUAqXRTfivLWlaBTAK0g4KywF3RXMtM/ofBp1inFWpBjjhFmhuZ PDlCJ98rce9FALI912Ap0C7LvG7xYEiQXB/I7WCJaXXqRkREpWPkzQWUStNCHuWU3GDjzLGDz 9PAxIl7Mge8SoECC/Tjgh11g== From: cmbecker69@gmx.de ("Christoph M. Becker") Hi Florian! On 31.07.2024 at 14:07, Florian Engelhardt wrote: > in this PR[1] it got mentioned that it could be beneficial to add a > userland function that tells you how much memory there is still available > for you to allocate. > I am writing to ask for your opinion on this, because technically it should > be doable with a few lines of user land code (see the change in the PR, at > least for Linux). Nevertheless it could be nice to have such a function > telling you how much memory there is left before the inevitable. > I really don't know if that would be beneficial to any other case than > these tests, but maybe there are some opinions here. > > [1] https://github.com/php/php-src/pull/14895 I have some doubts that a general function would be useful; after all, in most environments you are likely constrained by memory_limit. And I don't see an advantage implementing it in C, unless there would be any portable C API yielding the result. However, it seems to be a good idea to make that function available for re-use in the test suite, but I'm not sure where to put it, so that extensions build with phpize could use it, too. Probably I'm thinking too big here, and it would be good enough to add a file to tests/ or /ext/standard/tests/. Cheers, Christoph