Fixes #6247: Logger and error handler are now using slightly less memory