Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I just upgraded one of my WP website from 3.1.4 to 3.4.2 but i immediately got a

Fatal error: Allowed memory size of

message.

So i added define('WP_MEMORY_LIMIT', '128M'); to wp-config.php, but if i have to this with all my WP website i reckon i am out of memory pretty quick.

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

regards

ps: and why didn't i get the message when i used 3.1.4? is 3.4.2 using more memory ?

share|improve this question
add comment

2 Answers

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.

share|improve this answer
1  
Please see: meta.stackoverflow.com/questions/8231/… –  brasofilo Dec 1 '12 at 16:29
1  
Thank you for pointing that out. –  realloc Dec 1 '12 at 17:59
add comment

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 128k, 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 512k 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 128k. this way you will not need to worry about adding the WP_MEMORY_LIMIT define for every new site you install.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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