Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107315 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 85307 invoked from network); 24 Sep 2019 19:11:58 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 24 Sep 2019 19:11:58 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id 725EE2C0530 for ; Tue, 24 Sep 2019 09:50:54 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp3.php.net X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: X-Spam-Virus: No Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp3.php.net (Postfix) with ESMTPS for ; Tue, 24 Sep 2019 09:50:53 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id r22so1965944lfm.1 for ; Tue, 24 Sep 2019 09:50:53 -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=Hzkc2fCPeL7KbHubW+WKqOxFKPe1aB053jZnolmFMHk=; b=ustAFGrNJ4ROI+/jqr5zGwXeXDieuWKCCciokpJe3Tc4v135WXxGPM1xcoZY6FMZCE CTq/hJM0Zc73tXTINONyqe23M3FYlagWuEj7gFjjEvnFRZ1QadpaGi1fMb7dZEI+pG9L FbqY6g5isZQUNJIm3EV9s63HJgkOLJRqlAPLYQDDLCle6ktTN1iOVc1oa80M8dEfRvYG 5w1FbR5VD0HTiziahpnHpSR38KchJLAIAlq+aqJldX/r9y35Nurc8n5FrV59TdPyqqla WDFeRbgljX1TFH0MyS//9njBdG/kOduDrTMsWHd1jPXPqnJte1Dnl2QE95NHVf9eVSec csDA== 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=Hzkc2fCPeL7KbHubW+WKqOxFKPe1aB053jZnolmFMHk=; b=mTiHnn04J8V6ym7f8dHQEitJz8OYtCtWr9ppVX+VAb4/6J3eUJKX3kzKeA6hpI10va 3Tkx/D/5zjXOg2fZ3h0CmbBJ+9UXz3qhIx/ZqROm4p1+1kD6Hkxb4MY3dGRqextEB9gN sW/4p8Prax4luX7ww/gMW6lSK/0PdX2jfpQyci3NwHylLP8Vhx1sPPKkhTqHpGSij51P kKnSiv9tLxVDmPzeGILEmvyVk86XHR1wc03csW8iTUN1c4FeH5JPXsB24Ckl8JVoJquU L5iKCwyMf5GOxeeW3kxgHgXH2Ry3HZnzT91gm1JcBl5D3uKvDjMdnd839FmyqSVtKCSI IjBA== X-Gm-Message-State: APjAAAVJkkFL8TbuqdRmoY6Vt7HzAybVhTgJZRKuTB7Fcm3ueGukpT9s 5fbLSNVg1Z1kzZ/NOwFwCbYkJHuGXjeBfsA1Wpo= X-Google-Smtp-Source: APXvYqylJ1utylDAk8Imwo3IJ2Al27NGvteF11nQwVTXMnGN6uGp6PPR3ICG8E8yNMd2sTbjj3H6b4Qvhd/2Ldbjp10= X-Received: by 2002:a19:c396:: with SMTP id t144mr2604060lff.14.1569343852601; Tue, 24 Sep 2019 09:50:52 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 24 Sep 2019 18:50:35 +0200 Message-ID: To: Dan Ackroyd Cc: Peter Stalman , "internals@lists.php.net" Content-Type: multipart/alternative; boundary="000000000000dd64b205934f56db" X-Envelope-From: Subject: Re: [PHP-DEV] Shutdown Memory Allowance (aka Soft Memory Limit) From: nikita.ppv@gmail.com (Nikita Popov) --000000000000dd64b205934f56db Content-Type: text/plain; charset="UTF-8" On Tue, Sep 24, 2019 at 6:42 PM Dan Ackroyd wrote: > On Tue, 24 Sep 2019 at 07:26, Peter Stalman wrote: > > > > So I would like to suggest an option for setting a shutdown memory > allowance, > > which would be the amount of additional memory allowed to be used by any > > registered error handlers or shutdown functions. > > I can see the need, and what problem you're trying to solve. I think > focusing on 'memory to be used by shutdown handlers' is slightly more > specific than a solution needs to be. > > Just expressing it as, when PHP fails to allocate some memory due to > reaching the limit then: > > * Increase the memory limit by an ini setting defined amount. This > only happens once per request/process. > * Throw an EngineException. > > should cover what you want to do, without tying the solution to where > that memory can be used. > > One of the reasons I haven't submitted an RFC for that already is that > I'm not sure what would be involved in making sure it was safe to > throw an exception from places where the memory allocation could fail. > Throwing an exception on allocation failure is not possible. You could do the same while keeping a fatal error though. Nikita > FYI possibly of interest, I did some investigation of a related > feature a while ago, allowing people to trigger callbacks when the > memory limit was reached: > https://github.com/Danack/MemTrigger which is terribly out of date and > a bad approach anyway, due to the performance hit, and people only > really caring about hitting the memory limit. > > cheers > Dan > Ack > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --000000000000dd64b205934f56db--