Memory Limit

Knowledgebase Docs » UberMenu 3
USEFUL? 15
UberMenu 3

If you encounter an error along the lines of Fatal error: Allowed memory size of x bytes exhausted, it means your setup requires more memory than your server is configured to handle.

WordPress core, plus each theme and plugin you have activated, takes up some of the memory available to your server. As a simplified example, if you have 32MB of available memory, and you load 10 plugins, each requiring 5MB of memory, your 7th plugin will try to allocate 5MB when there are only 2MB available, resulting in a PHP memory limit error. Note that the error would occur whether the plugin requires 1MB and there were only 500KB remaining, or if the plugin required 50MB and all available memory remained, so the error does not actually indicate that there is an issue with a specific plugin, just that that plugin was running when your system ran out of memory.

Tip: You can check your PHP configuration settings by viewing the output of the phpinfo() function

Solution

Your cumulative memory requirements need to be less than your memory_limit, or else you will get an error. So you can either disable plugins or switch themes to reduce your memory load, or increase your memory limit.

There are a variety of ways to increase your memory limit

1. php.ini

Your server has a PHP initialization file (php.ini). To increase your memory, you change the memory_limit directive. Usually 64MB or 128M is a good amount.

memory_limit = 64M

The error message will indicate how many bytes (translate this to MB using Google if needed) your current system has allocated, and you can use this as a basis for how much you increase your limit.

2. wp-config.php

WordPress offers a way to Increase memory allocated to PHP in your wp-config.php file.

3. Contact your host

Depending on your host, you may or may not have access to php.ini, and they may disallow the wp-config.php solution. In that case, you will need to contact them directly to resolve the issue. If they refuse to increase your memory limit, you’ll either need to change your hosting plan or lighten your plugin/theme load to reduce the memory requirements of your installation.

Please note that this is not an issue with UberMenu – the available memory is shared among all plugins, theme, and WordPress core running in your installation. As the different parts of your installation load, they use up your server’s configured capacity. The error simply occurs on the function that happens to send it over the limit. Often the function that puts it over the top is only a few kilobytes.