[5.8] Allocate memory for error handling to allow handling memory exhaustion limits #29226
Allots 10kb of memory for "memory exhaustion" errors.
It lets the application give a more descriptive error than the default Fatal Error that is thrown for memory exhaustion.
The concept was taken from Symfony's error handler: https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/ErrorHandler/ErrorHandler.php.
From what I've been able to see, setting a variable to null frees the memory immediately.
Thanks for the feedback and comments!