Hi Internals,

When PHP runs out of memory, a fatal error is triggered and whatever shutdown
functions or error handlers take over.

However, in the case of error logging, or just logging in general, there often
needs to be additional memory used to accommodate the final logging process.

This can sort of be accomplished in userland a few ways:

1. Pre-allocating memory in a variable, such as the Yii2 error handler
(http://bit.ly/2kLnpd2), but this requires wasting memory on every request.

2. Continuously checking the memory usage, but this increases code complexity
needlessly and also wastes resources with constant checking.

3. A second process with its own memory allowance, but this also increases
complexity and transferring the required data for logging would require
serialization without using additional memory.  I'm not sure how this would be
accomplished.

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 think a C implementation of this in PHP would be far more efficient than the
userland implementionations I mentioned.

Thoughts?

Thanks,
Peter

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to