PHP memory usage
PHP memory usage is how much memory a WordPress request takes up once WordPress, all active plugins and the theme have loaded, before the request starts on its actual work. It’s the baseline that every page, every admin screen and every background task carries.
Why it matters
Section titled “Why it matters”Every request starts with this baseline, and the PHP memory limit has to cover it plus whatever the request does next: building the page, processing an image, importing data. The closer the baseline is to the limit, the less room is left, and the sooner a demanding task breaks off.
The server’s memory has to cover the baseline once for every request running at the same time. A higher baseline means fewer requests fit into the same server.
Watching the value over time is often more useful than a single number. When it grows after a plugin was installed or updated, that plugin brought more code or data along.
What influences it
Section titled “What influences it”WordPress: The most common cause of a high baseline is the number and size of active plugins. Each one loads its code, and many load settings and data at the start of every request, whether the page needs them or not. A large bundle of autoloaded options adds to it, as does a theme with many features.
Server: With OPcache, PHP keeps the compiled code in shared memory, outside the individual request, so the code counts less toward each request’s usage.
In Permo
Section titled “In Permo”Permo shows the value in two places: on the PHP memory card in System info, tab Server & System, as a share of the PHP memory limit, and in the History, view Server, as PHP memory over time, on a scale that reaches up to the limit.
Permo records memory usage at the start of every check, after WordPress, the plugins and
the theme have loaded and before Permo measures anything. The value is what PHP’s memory manager
reports as in use (memory_get_usage()), not the larger blocks PHP has reserved from the system.
Values are only comparable when the runs were started the same way: by WP-Cron, or by a click in the admin area. Runs from the command line (WP-CLI, or a server cron that starts PHP directly) leave the value empty; the card then shows a reading from a web request, such as the one taken when you open System info.
Related
Section titled “Related”Sources
- PHP: memory_get_usage, accessed
- PHP: OPcache, accessed