Fatal error: Allowed memory size of X bytes exhausted (tried to allocate Y bytes)
To convert bytes X into MB, divide by 1024*1024 or check at Wolfram.
happens when PHP tries to allocate Y bytes, but there is hard limit on X bytes set by PHP
memory_limit configuration settings.
The current limit can be checked by going to Administration » Reports » Status report » PHP (URL:
/admin/reports/status/php) or by printing
ini_get('memory_limit') in PHP (note that limit be different for UI and CLI).
In order to fix it, you need to lower your resource usage, for example:
disable any development modules which you're not using currently (recommended),
This includes: Devel, Devel Themer (if enabled).
disable any modules which you're not using,
disable certain debug variables which can impact on your memory resources, e.g. few examples with
drush -y vset rules_debug 0
drush -y vset rules_debug_log 0
disable certain PHP extensions, such as XDebug,
- enable redis/memcached caches and some PHP caches (e.g. OPCache/XCache),
- finally if above won't help - increase
memory_limit in your PHP configuration.
If you decide on increasing memory limit, a lot of people here advising to actually hack your core by pasting the PHP code into your
index.php to increase your PHP memory - never do that! It's a very bad practise.
Instead edit your
settings.local.php if you have it included) and paste the following code there at the end:
or a better way of doing this is to edit your PHP config file (
php.ini) and changing the following line:
memory_limit = 512M ; Maximum amount of memory a script may consume
If you're not sure where is your
php.ini, check by:
drush status command
- or by going at
To investigate further which pages/components are using the most memory, you've the following possibilities:
For further information, check: