On Tue, Sep 24, 2019 at 6:42 PM Dan Ackroyd <dan...@basereality.com> wrote:
> On Tue, 24 Sep 2019 at 07:26, Peter Stalman <sarke...@gmail.com> 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 > >