Last updated December 6th, 2023 00:05
The memory limit is a server restriction that is intentionally set by its administrator, and its size varies depending on the shared hosting provider. Generally, on web hosting, you can have memory ranging from 128 MB to 512 MB. The memory limit is a restriction. It determines the amount of memory a specific program or process can utilize on a computer. Let’s take a look in easy explanation: how to better use memory limit on WordPress. And why do so many people have issues with it?
Easy Explanation: How To Better Use Memory Limit On WordPress
The memory limit essentially acts as a safety mechanism, determining the maximum amount of usable memory for a single website. Why is it used? Simply because on shared hosting, you are not alone. There are usually dozens or even hundreds of other websites hosted alongside yours. Since the server has limited memory, restrictions need to be set for each individual web hosting account. This ensures the server remains functional and prevents a few large websites from completely consuming the memory.
Thus, the server administrator determines an upper limit based on the overall machine memory and the number of websites hosted on it. This sets a clear definition of the memory limit and explains why administrators utilize it.
Why does WordPress sometimes run out of allocated memory?
Typically, the issue lies with the website owner or developer. You may have encountered situations where you need to add a specific feature or functionality to your website. However, you may lack the necessary programming skills to accomplish this. Like many WordPress users, you rely on plugins to address the problem. This, in itself, is not a bad practice, but it becomes problematic when the website has an excessive number of plugins, leaving little available memory.
Each plugin on the website consumes and allocates a portion of memory based on its function and size. If there are too many plugins, they collectively consume so much memory that the system hits the memory limit, and no additional memory is available.
At that point, WordPress doesn’t have the ability to function properly because some of its components are not functioning correctly. They lack the necessary memory to perform their tasks. Usually, you will see your website non-functional with a similar-looking error (the error message may vary depending on what has collapsed):
fatal error: allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes) in /web/htdocs/www.mojedomena.cz/home/www/wp-includes/plugin.php on line 203
How to resolve the problem?
The solution is simple. You are using many plugins or components on your website, and you exceed the allocated memory. Here are two possible solutions to address the issue. One option is to logically reduce the number of plugins and remove those that are not critical for your website’s functioning. This will free up a portion of memory, and your website will become fully functional again (assuming the memory error is not caused by another issue, such as an error loop).
The second option lies with your web hosting provider. Within their capabilities, they can increase the memory limit. Whether they will do so or not depends on various factors, such as the hosting price, available server memory, the number of websites hosted, the provider’s willingness to modify the website’s php.ini, and many others.
The best approach, ensuring a fast and healthy website, is, of course, the first option.
Can non-critical plugins be replaced with something else?
Yes, in certain cases, non-critical plugins can be replaced with code snippets. Snippets are essentially short pieces of code that can be inserted either into the functions.php file or by using a specialized plugin for custom code insertion.
By using snippets, you can save a significant amount of memory. Additionally, since code snippets are not as resource-intensive as entire plugins, you can implement the same functionality on your website with minimal memory requirements.
Easy Explanation: How To Better Use Memory Limit On WordPress
Conclusion
Therefore, always make sure that you don’t immediately try to solve every issue on your website by installing a new plugin. Many problems can have very simple solutions without the need for a plugin. For example, a widely used plugin called Really Simple SSL is present on about 80% of websites simply because the owner doesn’t want to or doesn’t know how to resolve mixed content issues. So, before installing a new plugin, take a moment to do some minimal research to see if the problem can be resolved differently and more effectively. This way, you can often save a significant amount of allocated memory and improve your website’s speed.
The website is created with care for the included information. I strive to provide high-quality and useful content that helps or inspires others. If you are satisfied with my work and would like to support me, you can do so through simple options.
Byl pro Vás tento článek užitečný?
Klikni na počet hvězd pro hlasování.
Průměrné hodnocení. 0 / 5. Počet hlasování: 0
Zatím nehodnoceno! Buďte první
Je mi líto, že pro Vás nebyl článek užitečný.
Jak mohu vylepšit článek?
Řekněte mi, jak jej mohu zlepšit.
Subscribe to the Newsletter
Stay informed! Join our newsletter subscription and be the first to receive the latest information directly to your email inbox. Follow updates, exclusive events, and inspiring content, all delivered straight to your email.