WordPress Troubleshooting – Fixing the Allowed Memory Size Exhausted Error Print

  • Updated on 07-May-2024
  • 163

You have likely faced this error at least once while working with WordPress:

Fatal error: Allowed memory size of X bytes exhausted (tried to allocate Y bytes)

This error is caused when you do some heavy task in WP, like installing a plugin or theme. When a PHP script or plugin requires more memory than the limit set in the php.ini file, the “Allowed memory size exhausted” error message is displayed. This limit exists so that the server won’t crash or bear any other issues due to some PHP memory leak or bad code.

Below is a list of common causes for this error:

  1. Memory-intensive plugins/themes: Some plugins can be memory-intensive and cause this error. Follow this guide to catch the faulty plugin.
  2. Buggy or faulty code: Faulty or buggy code (e.g., a code resulting in infinite loops) may also cause this error. If you recently have added any custom code, theme, or plugin to your WordPress installation, try disabling it to see if that fixes the issue.
  3. Heavy image files: Using large images can cause errors because they consume a lot of memory. Compressing or reducing the size of your images will help you avoid this problem.
  4. Low PHP Memory Limit: Low PHP memory limit is the most common reason for this error. Please check the link below for ways to increase the PHP memory limit.

    How to Increase PHP Memory Limit for Your PHP Site or CMS Like WordPress


Important Note: 
A reasonable memory limit is 128MB; if your application is more resource extensive, you may increase it to 256MB. However, increasing it over this value is not recommended, like giving it unlimited memory is a terrible practice. Instead, optimizing the code or using an optimized version of the plugin or theme you intend to use is a better idea.

 

Pro Tip: You can use a caching plugin (like WP Fastest Cache, W3Total Cache etc) to reduce the amount of memory your website uses. Caching plugins cache your website’s pages thus reducing the number of requests to the server, which can help reduce the amount of memory your website uses.

 

Still, Having The Issue? After applying all the above solutions if you are still having issues, please contact our technical support team and explain the situation. If you keep getting the same error, consider upgrading your current hosting plan to a bigger plan. Or use a managed WordPress hosting account, which includes more optimized features for running WordPress websites.

 


Was this answer helpful?

« Back