Skip to content
Diamond Sierra

PB-2105: Request came close to the PHP memory limit

Paul Bunyan code PB-2105 (Warning): Request came close to the PHP memory limit. What it means and what to do.

Updated · By Diamond Sierra

On this page

What it means

Peak memory reached 80% or more of the PHP memory limit. Past the limit, PHP stops the request with a fatal error.

What to do

The details give the peak in MB. Look for large query results held in memory, big images, or exports built in one piece. Raising the limit hides the problem; a host's memory cap still applies.

Common causes

  • A query that loads every row of a big table into PHP (all orders, all users, all posts).
  • Building an export, sitemap or feed in one piece instead of in batches.
  • Large images processed in PHP.
  • A plugin that keeps a growing log or cache in one option and loads it on every request (see PB-3001).
  • Many plugins each loading large settings arrays at start-up.

How to find and fix it

  1. The details give the peak memory in MB. Open the request and look at which plugin and function were running when memory climbed.
  2. Process big jobs in batches (for example 100 rows at a time) and free each batch before the next.
  3. Remove large leftover options. The free autoload analyzer shows which ones load on every request.
  4. Raising WP_MEMORY_LIMIT only buys time; the request still grows, and a host's own memory cap still applies.

Details

CodeSeverityGroup
PB-2105WarningRequest