The most common cause of this error message for me is omitting the «++» operator from a PHP «for» statement. This causes the loop to continue forever, no matter how much memory you allow to be used. It is a simple syntax error, yet is difficult for the compiler or runtime system to detect. It is easy for us to correct if we think to look for it!
But suppose you want a general procedure for stopping such a loop early and reporting the error? You can simply instrument each of your loops (or at least the innermost loops) as discussed below.
In some cases such as recursion inside exceptions, set_time_limit
fails, and the browser keeps trying to load the PHP output, either with an infinite loop or with the fatal error message which is the topic of this question.
By reducing the allowed allocation size near the beginning of your code you might be able to prevent the fatal error, as discussed in the other answers.
Then you may be left with a program that terminates, but is still difficult to debug.
Whether or not your program terminates, instrument your code by inserting BreakLoop()
calls inside your program to gain control and find out what loop or recursion in your program is causing the problem.
The definition of BreakLoop is as follows:
function BreakLoop($MaxRepetitions=500,$LoopSite="unspecified")
{
static $Sites=[];
if (!@$Sites[$LoopSite] || !$MaxRepetitions)
$Sites[$LoopSite]=['n'=>0, 'if'=>0];
if (!$MaxRepetitions)
return;
if (++$Sites[$LoopSite]['n'] >= $MaxRepetitions)
{
$S=debug_backtrace(); // array_reverse
$info=$S[0];
$File=$info['file'];
$Line=$info['line'];
exit("*** Loop for site $LoopSite was interrupted after $MaxRepetitions repetitions. In file $File at line $Line.");
}
} // BreakLoop
The $LoopSite argument can be the name of a function in your code. It isn’t really necessary, since the error message you will get will point you to the line containing the BreakLoop() call.
This is a guide on how to fix one of PHP’s most common fatal errors: The memory exhausted error.
Here is an example of what this error might look like.
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32 bytes) in your-script.php on line 4
PHP’s memory limit.
If you encounter this error, then it means that your PHP script is using too much memory.
If you open the php.ini configuration file that your web server is using, you will come across the following directive.
; Maximum amount of memory a script may consume (128MB) ; http://php.net/memory-limit memory_limit = 128M
The memory_limit directive defines the maximum amount of memory that a PHP script can consume. In the example above, you can see that the memory_limit directive is set to 128MB.
This means that if one of my PHP scripts consumes more than 128MB in memory, the memory exhausted error will be thrown and the script will die.
If you do not have access to your php.ini file, then you can check what your server’s memory limit is using PHP’s init_get function like so:
echo ini_get('memory_limit');
Recreating this fatal error.
Here is a sample PHP script that I wrote to recreate this error.
$arr = array(); foreach(range(1, 900000) as $i){ $arr[] = md5($i); }
In the code above, I looped through 900,000 times using PHP’s range function and then added the md5 hash of each value to an array. After running the script above, I immediately received a fatal error telling me that my script had consumed too much memory.
Common causes of memory errors.
In my experience, the most common cause is a large PHP array. This is especially true in some of the earlier versions of PHP. However, it is worth pointing out that PHP 7 consumes far less memory and is far better-optimized.
A few cases where you might run into this memory exhausted error.
- Selecting rows from a database and then adding them to a PHP array is fine most cases. However, if you are returning millions of rows and columns, this might become an issue.
- If your script has large arrays and a lot of loops, there is a good chance that you might run out of memory. This is especially true if you have multiple loops or you are calling a lot of functions inside of those loops.
- Recursively looping through large multi-dimensional arrays can prove to be an issue.
- Dynamically creating or resizing images on-the-fly.
From my own personal experience, the most common cause is a large array or a database query that returns far too many rows.
For example, a badly-written JOIN query may return far more rows than you are expecting.
How NOT to fix this error.
On some of the various PHP help forums, you might across people offering solutions such as this.
ini_set('memory_limit', '1024M');
In the above piece of code, we are using PHP’s ini_set function to increase the memory limit.
This is a horrible solution because it does not attempt to fix the underlying problem. It can also cause your web server to run out of RAM.
This line of code attempts to paper over the cracks by giving the script 1GB of memory. In most cases, 1GB is far too much.
A more dangerous example.
ini_set('memory_limit', '-1');
This essentially tells the PHP script that there is no limit to the amount of memory it can use. In other words, it disables PHP’s memory limit.
Fixing memory exhausted errors the right way.
To fix this issue, a better approach is to.
- Use a debugger such as Xdebug to profile your script and find out where the memory leak is coming from.
- Make sure that your PHP arrays are not getting too large and that you are avoiding any unnecessary loops. In other words, if you have two loops for the same array, then you should combine them into one loop.
- Be careful about the amount of data that you are returning from your database. Make sure that you are only selecting table columns that your script is going to use. In other words, specifically name the columns that you want to return. Do not be lazy. By doing a “SELECT * FROM”, you are returning every column.
- Use PHP’s unset function to destroy variables that you are no longer using, as this can help free up memory. i.e. If you have just looped through a large array that you no longer intend on using, then you can destroy it by passing it into the unset function.
Ошибка Fatal error: Allowed memory size гласит о том, что вы достигли ограничения по памяти, которые у вас установлены в настройках web-сервера.
Например, текст ошибки:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 71 bytes) in … говорит, что 128 Мб не достаточно (число выше указано в байтах) и его нужно увеличить, либо в указанном месте решить проблему с утечкой памяти.
Решение проблемы с ограничением памяти
Есть два варианта как завершить операцию:
-
Оптимизировать скрипт.
-
Увеличить лимит по памяти.
Первый вариант сложен и не всегда возможен. Поэтому рассматривать его не будем.
Хотя, зачастую бывает так, что сайт, например, пытается сжать очень большую картинку в другой размер (например, фото в оригинале весит 20 Мб). В этом случае просто используйте оригинальные картинки меньшего размера.
Второй вариант проще и подойдет как временное решение, до тех пор пока не найдется основной корень зла. Существует несколько способов увеличить лимит.
Файл php.ini
Это рекомендуемый способ, если вы имеете доступ к файлу php.ini. Данный способ не сработает на многих платных хостингах провайдер, т.к. там закрывают доступ к этому файлу, в целях безопасности. Внимание! Данный способ затронет все ваши сайты и скрипты, находящиеся на сервере.
Откройте файл php.ini и найдите там строку memory_limit:
memory_limit = 256M
Через .htaccess в корне сайта
Добавьте в самом начале строку php_value memory_limit 256M. Во время выполнения PHP, запишите перед тяжелыми операциями в php-файл следующую строчку
<?php ini_set('memory_limit', '256M');?>
Как посмотреть, сработало ли?
Откройте в панели управления Joomla информацию о системе
И найдите строку memory_limit
Тоже самое можно сделать через команду <?php phpinfo();?>.
Если не получилось…
В случае, если рекомендации из статьи не помогли вам (возможно хостинг не дает таких прав), то обратитесь с этим вопросом к техподдержке вашего хостинга. Если хостер отказал, то рассмотрите вариант с выполнением тяжелых операций на локальной машине. Затем результат работы перенесите на ваш продуктивный сайт в интернете.
Альтернатива
Также оптимизации по памяти можно добиться установкой APC. Он уменьшает потребление памяти в ~1,5-2 раза и ускоряет работу всего сайта в целом. Для нормальной работы Joomla + JBZoo обычно хватает 64 Мб (с серьезным запасом на будущее).
A common error with Open Source Software like WordPress, Moodle, and Joomla is the php “Allowed memory size error.” Increasing the memory limit is an easy solution. This memory_limit can be changed in the php.ini in the public_html folder in your hosting account. This error can creep up in your website during the normal development process. The following is an example of the error:
Fatal error: Allowed memory size of 268435465 bytes exhausted
(tried to allocate 280559520) in Unknown on line 0
This is due to php variable data being stored in the memory that is not cleared while the php scripts are running.
For those who code their own sites: Coders use the unset() function to clear variable data that is no longer needed; however, with open source software, you will not want to alter any code.
How to fix the “Allowed memory size Error”
The php memory resource can be increased in the php.ini located in the public_html. The following steps will explain how to set the php.ini to allow a larger amount of memory use.
- Login to your cPanel
- Go to the File Manager.
- Select the Web root (public_html/www) directory and click Go.
- Find the php.ini file in the public_html.
Note! If you do not have a php.ini in your public_html files, you can have our tech support staff restore the php.ini to your public_html directory.
Open the php.ini with the code editor.
- Find the following section in the php.ini file.
max_execution_time = 30
max_input_time = 60
memory_limit = 128M
Try increase the memory_limit value to 256M.If the php memory_limit is already at 256M, you can increase it to 512M.
Save the changes.
- In order for your memory limit to take effect you will need to make the php.ini recursive.
Important! Making the php.ini recursive is an important step. If you do not know how to do this, please see our article on Make the php.ini recursive in the .htaccess.
Now visit the site. You should not see the “Allowed memory size” error anymore. If the error still shows on your website, there may be a setting within the software itself that is overriding the change or the php.ini in the public-html may be overriden by another setting elsewhere. If this is the case, you can contact our our tech support staff to have them look into the error further.
You may encounter one of the common errors when running the PHP website source code. And in this article, I will guide you to fix PHP Fatal Error: Allowed Memory Size.
Cases of this error in Magento 2 are also common. For example: Install Theme, Install Extension,…
When encountering this error, an error message will appear:
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes) in C:xampphtdocsmagento232vendoroyejorgeless.phplibLessTreeDimension.php on line 21
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes) in C:xampphtdocsmagento232vendoroyejorgeless.phplibLessTreeDimension.php on line 21
Reason
The cause of this error is because the PHP process is executing using larger RAM resources that we have specified in the php.ini
file through “memory_limit”.
This is the configuration table of “memory_limit”.
PHP: Fatal Error: Allowed Memory Size of 8388608 Bytes Exhausted | 8 MB |
PHP: Fatal Error: Allowed Memory Size of 16777216 Bytes Exhausted | 16 MB |
PHP: Fatal Error: Allowed Memory Size of 33554432 Bytes Exhausted | 32 MB |
PHP: Fatal Error: Allowed Memory Size of 67108864 Bytes Exhausted | 64 MB |
PHP: Fatal Error: Allowed Memory Size of 134217728 Bytes Exhausted | 128 MB |
PHP: Fatal Error: Allowed Memory Size of 268435456 Bytes Exhausted | 256 MB |
PHP: Fatal Error: Allowed Memory Size of 536870912 Bytes Exhausted | 512 MB |
PHP: Fatal Error: Allowed Memory Size of 1073741824 Bytes Exhausted | 1 GB |
You can collate to raise the appropriate value.
- First, You locate the directory of the
php.ini
directory. This will usually beetc/php.ini
.
- Next, You find the line “memory_limt =”
- Finally, You adjust the value accordingly and save it.
Good luck!
It comes to the end of the article.
You can view the article How To Install Magento 2.3 In Windows Using XAMPP.
Follow us for more helpful article!
We hope this is a useful blog for you.
Thank you for reading!
PROBLEM :
- We have a bunch of client Point Of Sale (POS) systems that periodically send new sales data to one centralized database, which stores the data into one big database for report generation.
- The client POS is based on PHP POS, and we have implemented a module that uses the standard XML-RPC library to send sales data to the service. The server system is built on CodeIgniter, and uses the XML-RPC and XML-RPCS libraries for the webservice component. Whenever we send a lot of sales data (as little as 50 rows from the sales table, and individual rows from sales_items pertaining to each item within the sale) we get the following error:
[pastacode lang=”php” manual=”Fatal%20error%3A%20Allowed%20memory%20size%20of%20134217728%20bytes%20exhausted%20(tried%20to%20allocate%2054%20bytes)%0A” message=”Php Code” highlight=”” provider=”manual”/]
- 128M is the default value in php.ini, but we assume that is a huge number to break. In fact, we have even tried setting this value to 1024M, and all it does is take a longer time to error out.
- As for steps we’ve taken for disabling all processing on the server-side, and have rigged it to return a canned response regardless of the input. However, we believe the problem lies in the actual sending of the data and tried disabling the maximum script execution time for PHP, and it still errors out.
SOLUTION 1:
- People, changing the memory_limit by ini_set(‘memory_limit’, ‘-1’); is NOT a solution at all.
- Don’t do that. Obviously php has a memory leak somewhere and you are telling the server to just use all the memory that it wants.
- The problem has not been fixed at all. If you monitor your server, you will see that it is now probably using up most of the RAM and even swapping to disk.
- You should probably try to track down the exact bug in your code and fix it.
SOLUTION 2:
- The correct way is to edit your php.ini file. Edit memory_limit to your desire value.
- As from your question, 128M (which is the default limit) has been exceeded, so there is something seriously wrong with your code as it should not take that much.
- If you know why it takes that much and you want to allow it set memory_limit = 512M or higher and you should be good.
SOLUTION 3:
- The memory allocation for PHP can be adjusted permanently, or temporarily.
Permanent:
- You can permanently change the PHP memory allocation two ways.
- If you have access to your php.ini file, you can edit the value for memory_limit to your desire value.
- If you do not have access to your php.ini file (and your webhost allows it), you can override the memory allocation through your .htaccess file. Add php_value memory_limit 128M (or whatever your desired allocation is)
Temporary:
- You can adjust the memory allocation on the fly from within a PHP file. You simply have the code ini_set(‘memory_limit’, ‘128M’); (or whatever your desired allocation is).
- You can remove the memory limit (although machine or instance limits may still apply) by setting the value to “-1”.
SOLUTION 4:
When adding 22.5 million records into an array with array_push we getting “memory exhausted” fatal errors at around 20M records using 4G as the memory limit in php.ini.
To fix this we added the statement
[pastacode lang=”php” manual=”%24old%20%3D%20ini_set(‘memory_limit’%2C%20’8192M’)%3B%20%0A” message=”Php Code” highlight=”” provider=”manual”/]
- At the top of the file it working fine. we do not know if php has a memory leak.
The program is very simple:
[pastacode lang=”php” manual=”%24fh%20%3D%20fopen(%24myfile)%3B%0Awhile%20(!feof(%24fh))%20%7B%0A%20%20%20%20%20%20array_push(%24file%2C%20stripslashes(fgets(%24fh)))%3B%0A%7D%20%20%0Afclose(%24fh)%3B%0A” message=”Php Code” highlight=”” provider=”manual”/]
- The fatal error points to line 3 until i boosted the memory limit, which eliminated the error.
EDIT: Corrected the syntax of ini_set.
SOLUTION 5:
When you see the above error – especially if the (tried to allocate __ bytes) is a low value, that could be an indicator of an infinite loop, like a function that calls itself with no way out:
[pastacode lang=”php” manual=”function%20exhaustYourBytes()%0A%7B%0A%20%20%20%20return%20exhaustYourBytes()%3B%0A%7D%0A” message=”Php Code” highlight=”” provider=”manual”/]
SOLUTION 6:
For Drupal users, this is the solution:
[pastacode lang=”php” manual=”ini_set(‘memory_limit’%2C%20′-1’)%3B%0A” message=”Php Code” highlight=”” provider=”manual”/]
works but we need to put it just after the opening
[pastacode lang=”php” manual=”%3C%3Fphp%0A” message=”Php Code” highlight=”” provider=”manual”/]
tag in the index.php file in your site’s root directory.
SOLUTION 7:
Your site’s root directory:
[pastacode lang=”php” manual=”ini_set(‘memory_limit’%2C%20’1024M’)%3B%0A” message=”Php Code” highlight=”” provider=”manual”/]
SOLUTION 8:
You can properly fix this by changing memory_limit on fastcgi/fpm
[pastacode lang=”php” manual=”%24vim%20%2Fetc%2Fphp5%2Ffpm%2Fphp.ini%0A” message=”Php Code” highlight=”” provider=”manual”/]
Change memory like from 128 to 512:
memory_limit = 128M
[pastacode lang=”php” manual=”%3B%20Maximum%20amount%20of%20memory%20a%20script%20may%20consume%20(128MB)%0A%3B%20http%3A%2F%2Fphp.net%2Fmemory-limit%0Amemory_limit%20%3D%20128M%0A” message=”Php Code” highlight=”” provider=”manual”/]
memory_limit = 512M
[pastacode lang=”php” manual=”%3B%20Maximum%20amount%20of%20memory%20a%20script%20may%20consume%20(128MB)%0A%3B%20http%3A%2F%2Fphp.net%2Fmemory-limit%0Amemory_limit%20%3D%20512M%0A” message=”Php Code” highlight=”” provider=”manual”/]
Wikitechy Founder, Author, International Speaker, and Job Consultant. My role as the CEO of Wikitechy, I help businesses build their next generation digital platforms and help with their product innovation and growth strategy. I’m a frequent speaker at tech conferences and events.
Related Tags
- Allowed memory size of 134217728 bytes exhausted (tried to allocate 18063885380364533825 bytes),
- Joomla and “Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 78 bytes)”,
- PHP Fatal error: Allowed memory size of 134217728 bytes exhausted,
- phpexcel Allowed memory size of 134217728 bytes exhausted,
- PHPExcel throws Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 71 bytes),
- PhpMyAdmin | Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate xxxxxx bytes) in Unknown on line 0,
- TCPDF Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 25368 bytes),
- Using pear : Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 6144 bytes)
PHP memory limits prevent poorly written scripts from using all of the memory resources on the server. To avoid PHP memory limit errors all WordPress sites should set memory limit values to 256MB via the wp-config.php, .htaccess or php.ini files.
Adjusting this value will satisfy the memory requirements of popular plugins like WooCommerce, WPML, Multisite and site builders. This prevents your site or admin dashboard from displaying the Fatal error: Allowed memory size of XXXXXXXX bytes exhausted (tried to allocate XXXX bytes) error message.
The default 40MB from WordPress is simply not enough memory to meet the demands of complex plugins and administrative actions in your WordPress dashboard. Thankfully there are 4 ways you can adjust these limits in WordPress.
Fixing PHP Memory Errors
1. PHP Memory Limit Error Causes
In order to prevent poorly written scripts from using up all the memory resources on your server a maximum memory limit (per script) is enabled by default. Out of memory errors are caused when scripts try to utilize more memory than wordpress has allocated.
By default wordpress sets PHP memory limits to 40MB for a single site and 64MB for multisites. Scripts that violate those thresholds cause error messages to show up like this one.
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 6969 bytes)
2. Recommended Memory Limit Settings
Changing your memory limit setting increases PHP Memory only for WordPress, not other applications. Furthermore, you will need to change the memory values for both your public pages and admin dashboard.. When executing administrative tasks (admin dashboard) more memory is often necessary.
A 256MB Limit and 512MB MAX Limit (wp-config.php) would be appropriate on shared hosting. Popular plugins like WooCommerce, WPML, multisite and most site builders require 256M to run properly.
If you are on a Cloud, VPS or Dedicated server you might wish to increase memory limits for public and admin even further. Limits could be increased to 512M for public pages and 1024M for the admin dashboard.
-
- define( ‘WP_MEMORY_LIMIT’, ‘256M’ );
- define( ‘WP_MAX_MEMORY_LIMIT’, ‘512M’ );
By default, WordPress will attempt to increase memory allocated to PHP to 40MB (located in /wp-includes/default-constants.php
) for single site and 64MB for multisite, so the when editing your (located in root directory) wp-config.php
you should enter an input higher than 40MB / 64MB respectively.
3. Public vs Admin Memory Limits
WordPress distinguishes between public facing page memory and admin memory by adding “MAX” to the code. It’s a terrible naming scheme dating back to WordPress 2.5, but nobody dares change it now.
- define(‘WP_MEMORY_LIMIT’, ‘256M’); Public Page Memory
- define( ‘WP_MAX_MEMORY_LIMIT’, ‘512M’ ); Admin Dashboard Memory
4. Bytes to MegaBytes Conversion Chart
If your website sends out an error message with specific byte sizes you can use this handy Bytes To Megabytes Conversion Calculator tool to estimate what memory limit has been exceeded.
1 byte is also equal to 0.00000095367432 megabytes = 2-20 megabytes in base 2 (binary) system.
Memory Limit Bytes | Megabytes |
---|---|
PHP: Fatal Error: Allowed Memory Size of 4194304 Bytes Exhausted | 4 MB |
PHP: Fatal Error: Allowed Memory Size of 8388608 Bytes Exhausted | 8 MB |
PHP: Fatal Error: Allowed Memory Size of 16777216 Bytes Exhausted | 16 MB |
PHP: Fatal Error: Allowed Memory Size of 33554432 Bytes Exhausted | 32 MB |
PHP: Fatal Error: Allowed Memory Size of 67108864 Bytes Exhausted | 64 MB |
PHP: Fatal Error: Allowed Memory Size of 134217728 Bytes Exhausted | 128 MB |
PHP: Fatal Error: Allowed Memory Size of 268435456 Bytes Exhausted | 256 MB |
PHP: Fatal Error: Allowed Memory Size of 536870912 Bytes Exhausted | 512 MB |
PHP: Fatal Error: Allowed Memory Size of 1073741824 Bytes Exhausted | 1024 MB (1GB) |
5. Accessing wp-config.php / php.ini / .htaccess
There are three ways you can easily access the needed wordpress files to adjust memory limits. You can access files using your control panel (Cpanel) after logging into your host, use an FTP program like Filezilla or install a wordpress plugin.
Navigate to the root directory of your wordpress installation. If you are in the control panel you might to click on the “View” link in the upper right corner and make sure the checkmark for “show hidden files” is selected.
- Cpanel – Control panel in your hosting admin dashboard
- Filezilla – Free FTP software to transport files
- WPCF – Free plugin that allows you to edit wp-config
6. Edit Your wp-config.php File
Accessing wp-config through Cpanel is the easiest method of changing your memory limit values in wordpress. It is located in the root directory of your wordpress installation after scrolling down to the bottom. Right click on the wp-config.php file, paste the memory limit values we provided and click save.
Alternatively you can use the search option (upper right corner) by typing in “wp-config” exactly as show and clicking “Go”. You also have the option to search through “All Your Files” or in a specific directory by clicking the drop down arrow.
Add this right above the line that says /* That’s all, stop editing! Happy publishing. */
define('WP_MEMORY_LIMIT', '256M'); define('WP_MAX_MEMORY_LIMIT', '512M');
Your server PHP memory limit will be different than your wordpress memory limit. Your host will set the server memory limit for all applications. Editing the wordpress memory limit settings only applies to wordpress.
7. Edit Your php.ini File
If you have access to your php.ini file, change the memory limit value. If you don’t have a php.ini file you can create one. If your line shows 40MB or 64MB try changing the value to “256M”
memory_limit = 256M ; Maximum amount of memory a script may consume (64MB)
Creating a php.ini file can be done by navigating to your yourdomain/wp-admin and clicking +FILE (top left corner) in cpanel. Name the newly created file “php.ini” and click “create new file”.
8. Edit your .htaccess File
If you don’t have access to PHP.ini or prefer not to edit wp-config.php try adding this to an .htaccess file:
php_value memory_limit 256M
The .htaccess file is located in your root directory. You can add your code right above “# END WordPress” at the bottom of the file.
9. Edit Using WPCF Plugin
Its generally bad to use plugins for tasks that you can easily do manually. If you just can’t seem to figure out how to change the wp-config using cpanel or FTP you can use a handy plugin called WordPress Config File Editor (WPCF).
After downloading and activating the plugin you can edit the wp-config by editing the memory limit (public pages) and max memory limit (admin dashboard) in the field boxes provided. Recommended values are 256M and 512M respectively.
Should you not feel comfortable in trying the above methods, or the above did not work for you, you need to talk to your hosting about having them increase your memory limit.
Some hosts do not allow changing your PHP memory limit, in which case you would have to contact your hosting support by emailing or opening a support ticket. Other (shared) hosts put a cap of 756M on the allowed memory limit. If you have Cloud, VPS or a Dedicated server these limits can be increased even further.
11. Troubleshooting Memory Limit Errors
If you have recently added a plugin to wordpress and encountered the fatal error memory limit message there is a high probability the culprit is the plugin you just installed. If you have increased your memory limits to 1024M and are still getting fatal error messages, its time to get serious about troubleshooting.
What about memory error messages that seemingly come out of nowhere?
Without getting too technical two options exist for detecting plugins that eat up server resources. One well known scan is P3 Profiler which scans the load time and query count of all the plugins used during your site load. The only trouble is its outdated, with 3 major WordPress releases since its last update.
A second option Query Monitor requires a bit more technical knowledge. It provides a wealth of information about your server and database configuration, peak memory usage and query count. This information combined with a basic waterfall chart from GT Metrix or Pingdom can help out big time.
In case you didn’t already know certain plugins are well known resource hogs. Here are some that make the list.
- Wordfence (Security/Firewall)
- BackupBuddy (Backup Programs)
- Site Builders (Divi, Elementor, Flatsome, Beaver)
- WooCommerce (Ecommerce store)
- BuddyPress (Forums & Message Boards)
- Disqus (Commenting)
- Add This (Social Media)
- Revolution Slider (Slider Plugins)
12. Memory Limit Key Points
- Wordpress separates memory limits by public pages (WP_MEMORY_LIMIT) and admin pages (WP_MAX_MEMORY_LIMIT)
- Admin pages (dashboard) require more memory than public pages (your website).
- By default WordPress allocates 40MB of memory. Change this to 256M (public pages) and 512M (admin pages) in wp-config.php
- Several plugins are known resource hogs and should be avoided or substituted for light weight options.
- WooCommerce, WPML, Multisite, Forums and Site Builders require a minimum of 256MB.
- Most hosting companies allow you to increase memory limits (some don’t) so contact your host as needed.
- WordPress memory limits are set on a per script basis, not the combined total. Limits are ultimately capped by your server resources.
- The easiest way to change memory limits is through cpanel and editing wp-config.php file in your root directory.