Guide

"Allowed memory size of … bytes exhausted"

Your WordPress site ran out of the memory your hosting plan gives each page, so the page stopped half-built. Your web host can raise the limit.

In short: building a page is like working at a desk, and your hosting plan decides how big the desk is. Every plugin spreads its papers out. When they don't fit, the work stops. Your host can give you a bigger desk, or you can clear away the plugin that takes up the most room.

Your posts and pages are still saved. "Memory" here means the working space the server lends your site while it builds each page, not your storage space or your hosting plan's disk.

What you'll see

If the site shows its errors
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /home/…/wp-includes/… on line 123. The numbers and the file differ from site to site.
Most WordPress sites
There has been a critical error on this website. WordPress hides the details from visitors and shows its critical error message instead.
In the recovery email
Under Error Details: An error of type E_ERROR was caused in line … of the file … Error message: Allowed memory size of … bytes exhausted.
A blank white page
The same fault with no message at all, on older WordPress or a site with the message switched off.

It can hit one page (a big shop page, a long list), the admin screens, or picture uploads, and leave the rest of the site working.

What the number means

The first number is the limit, in bytes. Divide by 1,048,576 to get megabytes (MB):

The message saysYour limit is
33554432 bytes32 MB
41943040 bytes40 MB (WordPress's own starting figure)
67108864 bytes64 MB
134217728 bytes128 MB (PHP's own starting figure)
268435456 bytes256 MB
536870912 bytes512 MB

The second number ("tried to allocate") is only the last small piece the page asked for. It doesn't tell you how much more it needs. The file and line show where it ran out, which isn't always the plugin that used up the space.

If it's your site

Fix it the same day if the error is on pages visitors use.

  1. See your limit: Tools › Site Health › Info › Server › PHP memory limit. If there's also a line called PHP memory limit (only for admin screens), that's the bigger allowance WordPress gives the admin, which is why the admin can work while the public pages fail.
  2. Think about what changed. If it started after you added or updated a plugin or theme, switch that one off first (Plugins › Deactivate). A faulty plugin can use up any amount of memory, and a bigger limit only delays the error. If you can't get into the admin, follow the critical error guide.
  3. If nothing changed, or the site has simply grown (more plugins, a bigger shop), ask your web host to raise the PHP memory limit. 256 MB is a sensible figure to ask for: it's what WordPress gives its own admin screens by default.
  4. Check the page again in a private (incognito) window once they've done it.

If the error comes back after the limit has gone up, something is using memory without stopping. Turn plugins off one at a time to find it, or ask your web person.

What WP_MEMORY_LIMIT does

WP_MEMORY_LIMIT is a setting in wp-config.php, WordPress's main settings file on the server. It tells WordPress how much memory to ask PHP (the programming language WordPress runs on) for on public pages. A web person adds it as one line, above the line that says That's all, stop editing!:

define( 'WP_MEMORY_LIMIT', '256M' );
  • It can only ask for more, never less. If your host already gives 128 MB, WordPress's starting figure of 40 MB (64 MB on a multisite network) changes nothing.
  • It only works if your host lets sites change their own limit. Many shared hosts don't, and then the line does nothing at all. WordPress's own advice in that case is to contact your host.
  • WP_MAX_MEMORY_LIMIT is its partner for the admin screens and for resizing pictures. It's 256 MB unless your host's limit is already higher.

You can see both under Tools › Site Health › Info › WordPress Constants. Editing wp-config.php wrongly can take the whole site down, so leave it to your web person or host, and have them keep a copy of the file first.

If you're visiting a site

The fault is on the website, not your phone or computer. Try another page, or come back later. If you were paying for something, check your email or bank before trying again, so you don't pay twice.

Send this to your web host

Not sure what to say? Copy this into an email, add your website's address, and send it.

Hi,

Our WordPress website shows "Allowed memory size of [number] bytes exhausted" (or "There has been a critical error on this website").

Where: [page address, or "admin" or "uploading pictures"]
It started on: [date and time]
Just before it started: [any update or new plugin, or "nothing I know of"]
Site Health shows a PHP memory limit of: [number]

Could you raise the PHP memory limit to 256M, and tell me if your logs show which plugin or page is using the memory?

Thanks

Find out sooner next time

Site Watch checks your home page once a night and emails you if it stops loading. It won't see the admin screens or an error on one inner page.

PageKiwi Tips

Plain-English website tips by email, coming soon. Unsubscribe in one click.

  • The two dates that take a website offline, and how to never miss them
  • A three-minute accessibility check anyone can do
  • How to spot a fake "your domain is expiring" email

We email you a link to confirm first. Never sold or shared. What we keep · Past tips

Know someone this would help? Share it

Quick question

Did this guide help with your problem?