Privacy

WordPress allowed memory size exhausted: find the task before raising the limit

A memory fatal error names a failed allocation, not necessarily the cause. Compare the effective PHP limit, WordPress request and specific task before choosing a repair.

Made by Pagember · Editorial policy

Editorial guidancePublished Updated Sources

The short answer

Identify the exact failing task before raising the memory limit. Read the first figure in the error as the limit, not the amount the task needs, and check the effective values in Site Health Info. If the limit is already 256 MB or more, raising it rarely fixes the cause. Preserve a recovery point, avoid rerunning partial imports, and fix the evidenced workload.

On this page8 sections

Allowed memory size exhausted tells you that a PHP allocation failed under the relevant limit. It does not, on its own, identify the component that created the workload or tell you how much memory a WordPress site should have. Start with the exact failing task and the configuration actually used by that task.

The official WordPress W identifies a conceptual memory-budget tray and an oversized task block that reaches its limit.

Read the numbers in the message first. In “Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes)”, the first figure is the limit: divide by 1,048,576 to get megabytes, here 256 MB. The second figure is only the last small request that failed, not the total the task needs. If the limit shown is 40 MB or 64 MB, WordPress is probably running on its own defaults; if it is already 256 MB or more, raising it further rarely fixes the cause.

To see the limit WordPress actually received, open Tools → Site Health → Info. The Server section shows the PHP memory limit, and WordPress Constants shows WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT. Those values are the evidence; a line in a file is only a request.

For example, suppose a large archive import stops with this fatal error while public articles still open. The steps below find the failing task before anyone picks a larger number.

Record the error and the operation together

Keep the error time, time zone, action, input scope, installed versions and most recent relevant change. Record the reported allowed bytes and attempted allocation without exposing server paths or private filenames in a public ticket. Ask an authorized operator to retain the protected original log.

The file named at the failure location is a useful lead. It is not proof that the file's owner alone caused the earlier allocations. For the archive import, establish which import step failed, what had already completed and whether a repeat could create duplicate records.

Preserve the affected content and a usable recovery point before changing the workload. Do not repeatedly rerun a partially completed import merely to obtain another error message. The current data state is part of the incident, especially when a task performs writes before it stops.

Separate allocation limit from hosting capacity

The PHP configuration manual defines memory_limit as a script-allocation bound. That value is not the same as a hosting account's physical capacity. PHP 8.5 also provides max_memory_limit, a startup cap on requested values; earlier versions and host policies can behave differently.

Ask the host which PHP version and runtime executed the failed import, which effective limit applied and whether a supported change is available. Do not treat a number from an unrelated command-line session or another website as proof of this request's configuration.

If the host's ceiling is the problem for routine work, a plan with more PHP memory per process is a legitimate fix. Managed WordPress hosting from Kinsta or a ScalaHosting managed cloud VPS gives you more room, and UltaHost offers WordPress plans to compare; confirm the per-process limit on the plan page before moving. The hosting resource-limits guide distinguishes provider units and constraints. Use it to frame the capacity conversation. A new PHP setting cannot be assumed to remove every account, process or concurrent-workload constraint imposed by the hosting arrangement.

Understand what WordPress constants request

The WordPress configuration handbook describes WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT. These are requests within the runtime arrangement, not purchased memory. A host can restrict changes, and an administration task can have a different requested limit from an ordinary public-page request.

The wp_raise_memory_limit reference shows that a request can return false when memory_limit cannot change. The effective configuration remains the relevant evidence; a constant written in a file is not proof that the running task received that value.

When an increase is justified, add the constants to the site's wp-config.php above the line /* That's all, stop editing! */, so they load before wp-settings.php:

define( 'WP_MEMORY_LIMIT', '256M' );      // front end
define( 'WP_MAX_MEMORY_LIMIT', '512M' );  // wp-admin and heavy admin tasks

WordPress cannot go above the PHP memory_limit set by the host, so if Site Health still shows the old value after saving, the change has to be made in the hosting panel's PHP settings or by support. Have the operator confirm the correct installation and configuration path before any edit. A shared hosting account can contain several sites. Record the actual value, context and supported override location for this one, instead of copying a snippet into every configuration file that looks plausible.

Build a task-focused comparison

ObservationComparison to requestWhat it does not prove
Only the archive import failsSame workflow with a supported smaller input in stagingAll ordinary pages need more memory
Failure began after one changeControlled comparison with the last working component setThe last changed file is certainly responsible
A configured increase has no effectEffective runtime value and host override rulesAnother larger number will be accepted
Several unrelated tasks failShared workload and runtime evidence from the operatorDatabase corruption or a security incident

Make comparisons in a recoverable environment with representative data, and label any difference from the live workload. A tiny demonstration may show that a tool starts successfully without showing it can complete the real archive. Keep input size and completed steps in the record.

Ask the component maintainer whether a supported batch or streaming workflow exists for this task. That question is more actionable than requesting an undocumented maximum. Do not split files arbitrarily if the importer requires one coherent input or cannot safely resume.

Use a controlled component investigation

If evidence points to an interaction, the safe plugin-conflict guide provides a comparison workflow. Change one relevant condition at a time in a suitable test copy. Preserve the active configuration and recovery instructions, rather than deactivating essential features on the public site without a plan.

Send the maintainer a redacted record of the task, versions, effective limit and reproduction scope. Explain what completed and what did not. A report that says “your plugin uses too much RAM” without those details gives the maintainer little to investigate and may blame the wrong layer.

If support asks for private data or a full database, decide what evidence can be shared safely through an approved route. A staging reproduction should not casually expose customer records, account secrets or a live configuration file.

Choose a bounded repair, not an unlimited setting

A justified repair may change an inefficient workload, use a supported smaller batch, correct a runtime mismatch or increase a supported allocation within available capacity. The evidence and responsible operator should determine which action fits. These choices are not interchangeable remedies for every fatal error.

Before a limit increase, record the previous setting, intended new value, scope and review point. Ask the host about concurrent work and operational impact. Removing the limit altogether can hide an allocation problem while transferring the risk to other tasks, so it is not a reasonable default diagnostic step.

The autoloaded-options guide addresses another possible workload concern. A warning there is not proof of this task's cause, and a memory fatal is not authorization to delete options. Connect the two only when task-specific evidence supports that connection.

Verify completion and the state of the data

  1. Repeat the affected operation through its supported, recoverable workflow.
  2. Confirm the effective runtime configuration and review the relevant error window.
  3. Check that expected records or files are complete, with no duplication from retries.
  4. Confirm ordinary public and administration journeys still work.
  5. Retain the bounded setting, recovery instructions and any remaining workload limit.

The site is not repaired merely because the last attempt took longer to fail or stopped displaying the fatal publicly. A successful result connects the intended task, correct data state and a configuration the operator can maintain.