Fatal error: Allowed memory size of x bytes exhausted

Edit on GitHub

One of the following errors is returned in the error log:

Fatal error: Allowed memory size of x bytes exhausted (tried to allocate x bytes) in {FILE_NAME}
PHP Fatal error: Out of memory (allocated x) (tried to allocate x bytes) in {FILE_NAME}

Solution

Increase memory_limit as described in image: php:.

Memory limit for a single command

If the issue appears only when running a CLI command, alternatively you can set the memory limit only for the command as follows:

php -d memory_limit=2G {COMMAND}