How to Fix WordPress Memory Exhausted Error: Allowed Memory Size


If you’re setting up your website with WordPress, you might notice an error message that looks like this when trying to install plugins or themes: WordPress Memory Exhausted Error or Fatal error, memory exhausted.

Don’t worry!

This error is actually easy to fix if you know how to do it, which we’ll explain in this article. Here are the three steps you can take to solve the WordPress Memory Exhausted Error and get back to setting up your website.

Disclosure: I may receive affiliate compensation for some of the links below at no cost to you if you decide to purchase a paid plan. You can read our affiliate disclosure in our privacy policy.

Fixing the Error

There are a couple of ways on how to go about resolving this error. These include:

  1. Monitor memory usage
  2. Increase WordPress memory limit
  3. Increase PHP memory limit
  4. Change your query_cache_limit value
  5. Update WordPress
  6. Stop using certain plugins
  7. Move to a VPS or dedicated server

1. Monitor memory usage

If you suspect that your site is leaking memory, there are a number of things you can do to check.

First, monitor your server’s memory usage over time using a plugin like WP Performance Monitor or Status Magic.

This will help you catch any sudden changes in memory usage so that you can troubleshoot them immediately. Next, try enabling some debugging tools by adding

define( 'WP_DEBUG', true ); 

to wp-config.php and then re-load your website; many memory leaks show up as fatal errors on your page, which should make it easy for you to find and fix.

Finally, perform a quick search online for WordPress memory leak plugin, if you have a large site with lots of plugins (or even worse, if your site isn’t hosted properly), chances are someone has written an add-on specifically designed to detect and repair leaks.

And while you’re at it, look into upgrading your hosting plan—memory hogs aren’t good news for anyone!

2. Increase WordPress memory limit

If you’re a WordPress user and run into issues with memory exhaustion, you may have to increase your WordPress memory limit by making a few changes in your wp-config.php file.

Follow these steps:

  1. In your preferred text editor, open up wp-config.php (this is usually located in /public_html/wp-content/themes/ or similar folder).
  2. Scroll down until you see a section labeled Multisite Network Settings
  3. Add define( ‘WP_MEMORY_LIMIT’, ‘128M’ ); above that line.
  4. Save and close wp-config.php
  5. Restart Apache (on Windows) or Unix/Linux server
  6. Create an empty file named watermark
  7. Upload it as public_html/wp-content/themes/.watermark
  8. Refresh WordPress Admin
  9. You should now be able to edit images without getting error messages related to lack of memory on your site!
    The 128MB figure can be changed for any amount you feel comfortable with, but note that if you go too high (such as 512MB), WordPress will start crashing after a while—so just watch how much memory your site uses over time.
    This is more than enough for most WordPress sites out there; we recommend not setting it lower than 192 MB because otherwise some themes may have problems running correctly.

3. Increase PHP memory limit

This error is generally due to a low memory limit configured in your php.ini file, which determines how much memory PHP can use.

By default, it’s only 128 MB. As WordPress is a large application, it needs more memory than that to work properly.

To fix: Go into cPanel and find phpMyAdmin (it should be on its own line). Click on it and follow its prompts to increase your PHP memory limit up by 16MB at a time until WordPress works again.

If you want WordPress to always run with more memory for speed and stability, enter these values into your wp-config.php file instead of changing phpMyAdmin settings:

define('WP_MEMORY_LIMIT', '64M'); // 64 megabytes 
define('WP_MAX_MEMORY_LIMIT', '128M'); // 128 megabytes

After making changes, save the file and refresh your website before confirming if they worked.

You can check your memory usage under Settings > General . You might see something like Memory Usage / Total Used Memory. If so, try restarting your site and refreshing it again, as there may be caching issues causing problems.

It’s also worth trying an alternate browser such as Chrome or Firefox to confirm that plugins aren’t causing problems with memory limits. Another alternative solution would be to download WP Optimize, another plugin from iThemes, however, it will not allow all resources to be used when running W3TC.

In addition, your server must support mod_rewrite (server configuration) to take advantage of using WP Optimize.

If you think all solutions have been exhausted and none are working correctly, a good option would be to contact your host regarding adding additional PHP memory because increasing the limit manually could have adverse effects if applied incorrectly.

4. Change your query_cache_limit value

To fix WordPress memory exhausted error, you need to reduce your query_cache_limit value.

Log in as a user with administrator privileges. Click on Settings option. Go to Performance tab and uncheck Enable query cache option.

Click on Save Changes button at bottom of page.

Visit your website and try browsing again, that should solve WordPress memory exhausted error for you.

If you are still getting same issue, then log in as root user by typing following command into your terminal: $ sudo su –

Type following command to change WordPress query_cache_limit value:

$ vi /etc/php5/apache2/php.ini

Change maximum size of memory used by PHP (in MB) from 128M to 64M or 32M. See if it’s working now.

5. Update WordPress

The most common way WordPress users experience memory exhausted error is by not keeping their plugins and themes up-to-date.

If you don’t remember when you last updated your WordPress installation, do it now. It’s also important to make sure that you are running a supported version of PHP.

Usually, if you run out of memory errors, it is time for a new hosting plan with more RAM available. If all else fails, try switching to another WordPress theme or plugin; they might be doing something much heavier than expected.

Try disabling every other plugin on your site except for one (only leave WordPress Jetpack activated) and see if that fixes it—that could tell you which one was causing issues. Don’t forget about database optimization either!

6. Stop using certain plugins

If you get a WordPress memory exhausted error when trying to upload photos, there are usually one of two issues at play.

The first is that your server may not have enough memory available (in which case, contact your host and see if they can upgrade your plan).

The second possibility is that a certain plugin is causing an issue. Try uninstalling any unnecessary plugins and seeing if that resolves things for you. If so, figure out which plugin is responsible by disabling each one individually and testing.

Be sure to disable activated plugins from within your WordPress dashboard — do not just delete them altogether (you can always reinstall them later).

Also be sure that you’re following best practices for image sizes: Always use a photo editor prior to uploading images on WordPress and resize them down as small as possible before transferring them over.

This will keep WordPress from having to resample them (which takes more time and resources). When selecting pre-made WordPress themes, it’s important to take note of how many different media/image files are being loaded.

Generally speaking, a theme should only load what is absolutely necessary in order to prevent slow page loading times and potential errors in years ahead.

7. Move to a VPS or dedicated server

If you are using a shared hosting plan, you can easily swap it out for a virtual private server (VPS) or dedicated server.

If you’re experiencing frequent memory errors, such as out of memory error or WordPress memory exhausted error, moving to a VPS could help your website run smoothly.

You can also try adding more RAM or upgrading your web host—though these solutions may not be feasible in all situations.


Let me know which of this method worked for you and how did you fixed your Memory Exhausted Error. Comment your method below.

That’s all.

However, your needs may be different from mine. Which plugin is your favorite, and are you currently using it on your site? Do you have any other recommendations to add? Please voice your thoughts in the comments below!

You can also subscribe to our YouTube and Like and Follow us on FacebookTwitter, and Instagram.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *