I’m trying to troubleshoot a memory issue I’ve run into with WordPress and rather than bore you with the whole problem I was hoping to get a nice compact answer to three parts of my problem:
-
Normal Memory Footprint. I know there is no real “normal” WordPress script and yet I think it would be quite useful to hear from people what a typical WordPress script’s memory footprint is. Let’s call “normal” for sake of argument as a installation with very few plugins, a base type theme like twenty-twelve, and a script that has some DB retrieval but nothing monumental … maybe a typical blog roll page or something. What I’m trying to understand is what is the baseline memory footprint (a range not a discrete number) that a more complicated script would be starting from?
-
Memory Ceiling Versus memory_get_usage(). I have been putting lots of logging in my scripts that pull out the memory usage by using PHP’s memory_get_usage(true) call. This seems like one of the few troubleshooting techniques that determine where the memory is being used but what perplexes me is that I see memory usage ranging from 15M to 45M at the script level — note this is with the “true” parameter so this includes the overhead of the memory manager – and yet in many instances I’ll see a 27M script all of a sudden fall over with the message that the “Allowed memory size of 268435456 bytes exhausted”. It is possible that maybe there is one very large memory request that takes place after the logging but I’m interested to hear if other people have found any differences between the memory limit and the memory reported by memory_get_usage()?
-
New Memory Ceiling Ignored. In a desperate attempt to get the site back to working — and buy me time to troubleshoot — I thought I’d just up the memory limit in the php.ini file to 512M but doing this seems to have had no impact. The fatal error continues to talk about the old 256M limit.
Any help would be appreciated. Thanks in advance.
Hopefully someone can answers your question so detailed. By my side:
Q: What is a normal amount of memory for a WordPress script to use?
A1.- As a WP is a plugin driven CMS, memory depends on these plugins. As you must know there exists very bad coded ones. But an out-of-box WP has a very good performance.
A2.- To try helping you to find bottlenecks I recommend you to use BlackBox (WordPress Debug Bar Plugin )
I just found this interesting article:
WordPress Memory Usage & Website Outage Issues Resolved.
I ran a test for WordPress 4.4 with a clean install on a windows 7 PC (a local install).
Memory Used / Allocated:
9.37 MB / 9.5 MB
Total Files:
89
Total File Size:
2923.38 KB
Ran in
1.27507 seconds
This was all done in the index file, timing before anything is called and memory / file usage after everything is 100% finished.
I tried a few pages (category, archive, single post, etc..) and all were very similar (within 1% difference) in files and memory usage.
I think it stands to reason this would be the best possible performance, so adding plugins /content will only bump these numbers up. May be possible a caching plugin would offer a little better performance though.