English
+370 5 205 5502 sales@monovm.com

How to Increase Allocated Memory in WordPress

Some WordPress users run into the Memory Exhausted error. Today we will show you how to fix it and increase allocated memory in WordPress.

15 Jun, 21 by linda Y 5 min Read

List of content you will read in this article:

 Website management is a complex and tricky thing, even if you are using a very beginner-friendly and easy-to-use content management system such as WordPress. No matter how careful you are with plugin installation and configuration, you are surely going to run into an error at one point or another, and possibly even your entire site might go down.

Downtime only harms a site’s reputation and could turn away new customers if the site is business-oriented. Therefore, any errors that affect the site’s performance need to be fixed as soon as possible. Luckily, the majority of all sites on the internet are hosted using WordPress and there is a plethora of information out there on how to fix almost any error.

Today, we will be adding to that information and showing you how to fix the WordPress “Allowed memory size of bytes exhausted” error. Without further ado, let’s get right into it.

 

WordPress is written in PHP, a server-side programming language. Web servers are just like any other computer. They need memory to efficiently run multiple applications at the same time. Server administrators allocate specific memory sizes to different applications, including PHP.

When the allowed memory size of an allocated amount of bytes is exhausted it means the PHP script responsible for running a process or function has been exceeded. This can occur when there are poorly optimized scripts or too many resources (like plugins) attempt to allocate too much or all of the memory available on a server. When this happens, WordPress gives you the following error: “Allowed memory size of bytes exhausted”.

It will look something like this:

 

There are a few possible reasons why this error could occur. Therefore, there are multiple methods you could apply to try and fix it.

Method 1

Try adding this line to your wp-config.php file: define('WP_MEMORY_LIMIT', '128M'); To do so, follow these simple steps:

Step 1: Go to your control panel first.
Step 2: Enter the File Manager section.
Step 3: Then go to Public_html folder.
Step 4: Open the wp-config.php file with the editor.
Step 5: Add the following code.
define ('WP_MEMORY_LIMIT', '128M');
Step 6: Then save the file.

Method 2

If you have access to your PHP.ini file, change the line responsible for memory allocation in it. If your line shows 32M try 128M: 
memory_limit = 128M ;

Method 3

If you don't have access to PHP.ini try adding this to a .htaccess file: 
php_value memory_limit 128M

Method 4

Here’s a general rule for WordPress site management: If you have just updated a plugin or theme and you're seeing errors, try rolling back to a previous version.

In most cases, if you get a memory limit error it's due to a faulty plugin or theme. If you set it to 128 M using one of the previous methods, and are still getting the error, then you for sure know it's due to a faulty plugin. So the key question is what plugin did you install prior to this and uninstall it.

If this still doesn’t work, disable all plugins and start re-activating them one by one until you run into the error again. This way you will know that the plugin you enabled last is the culprit.

Method 5

If none of the aforementioned methods helped you get rid of the error, it is time to contact your hosting provider.  They can look into it and help you with any further steps you need to take. If you have a web hosting service from Monovm and are facing this error, you can contact us via live chat, email, or our advanced ticketing system and we will assist you in solving this problem.

 

Use the TPC! Memory Usage plugin to track the memory usage in your WordPress. 

TPC! Memory Usage allows WordPress administrators to view the current and peak memory usage of the application. This is extremely helpful when testing new plugins, or if there are a lot of modifications, plugins, or large language files.

 

While there are also other possible causes for the WordPress Memory Exhausted error to occur, for the majority of cases, the methods outlined in this tutorial are more than sufficient to get rid of it. If you were able to resolve this error in a different way, have any questions about the methods show in this blog, or have other suggestions, please leave them in the comment section below.

linda Y

My name is Linda, I have Master degree in Information Technology Engineering. I have some experiences in working with Windows and Linux VPS and I have been working for 2 years on Virtualization and Hosting.