I've just upgraded one of my WP websites from 3.1.4 to 3.4.2 and I got an error message.

Fatal error: Allowed memory size of

To fix it, I added define('WP_MEMORY_LIMIT', '128M'); to wp-config.php, but if I have to do this with all my WP websites I reckon I will be out of memory pretty quick.

How can I check the amount of memory a plugin or theme is using?


PS: Why didn't I get the message when I used 3.1.4? is 3.4.2 using more memory?


There is a very nice plugin called P3 (Plugin Performance Profiler). Give it a try!

This plugin creates a profile of your WordPress site's plugins' performance by measuring their impact on your site's load time. Often times, WordPress sites load slowly because of poorly configured plugins or because there are so many of them. By using the P3 plugin, you can narrow down anything causing slowness on your site.

  • This plugin uses the canvas element for drawing charts and requires requires Firefox, Chrome, Opera, Safari, or IE9 or later. This plugin will not work in IE8 or lower.

For your second question you could read WordPress Benchmark: 3.0 vs 3.1 vs 3.2 vs 3.3.
text only mirror in google cache

WordPress now has 4 versions in 3.x line. With slow adoption rate for previous two major versions, despite great 3.2 release, question is will the new WordPress 3.3 manage to persuade users to upgrade? This benchmark will try to give, at least, partial answer to that.

  • 1
    Please see: meta.stackexchange.com/questions/8231/… – brasofilo Dec 1 '12 at 16:29
  • 1
    P3 only reports the loading time, but not the memory consumption of each plugin. Long loading time may not be associated with high memory footprint. – Raptor Aug 7 '15 at 2:37
  • P3 (Plugin Performance Profiler) :- This plugin is not Compatible with PHP 7. – Pankaj Nov 2 '17 at 12:25
  • I answered this question 5 years ago... ;) – realloc Nov 3 '17 at 8:27

with interpreted languages like php every line added to the code means more memory consumption, so it is trivial that with every feature added WP requires more memory.

You don't specify when you got that message, and if you are running a non english WP. I think that many strings were added as part of the builtin help system, and if you run a translated WP you load the translation of them as well.

If you upgraded only the WP then it is unlikely that the fault is with a theme or plugin. It is hard to measure how much memory each plugin and theme uses as most of it is probably allocated dynamically and changes between different front end/admin pages on the site. For example less memory will be consumed on single post page then on category page as there is simply less data to process.

If memory is an issue, and you can make changes to the server then you should install apc or other php accelerator. Since they precompile the php code into byte code and it takes less memory (and executes faster).

BUT.... I'm totally not sure you are going to run into a problem if you set WP_MEMORY_LIMIT on all of your sites. WP_MEMORY_LIMIT just say to WP (and WP communicates it to the php interpreter) that the maximal memory consumption can be 128M, but WP doesn't allocate this amount of memory on start up, and unless something is totally wrong with your plugins and theme, most of the time you are well below it.

So the important thing to know is what specific operation causes the high usages of memory. If it is only in admin then don't worry about it. For example, a very simplistic and inaccurate calculation - if you have 512M allocated to your server you will be able to handle 4 max memory page requests at the same time, but what is the chance of 4 admin pages being accessed at exactly the same time (the exact same second)? very close to 0 for most WP sites.

And there is even easier thing you can do - in you php.ini file set memory_limit to 128M. this way you will not need to worry about adding the WP_MEMORY_LIMIT define for every new site you install.

  • @Raptor, while I agree it is funny, pointless comments about obvious syntax errors are just annoying (generating email etc). If you find errors like this that you think are worth fixing, please just submit an edit. – Mark Kaplun Aug 7 '15 at 2:51
  • alright. Submitted an edit. Don't have as many credits as in Stack Overflow, my edit is in queue of peer review. – Raptor Aug 7 '15 at 3:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.