View Categories

WordPress Memory Exhaustion

1 min read

What memory exhaustion looks like #

The error reads: “Fatal error: Allowed memory size of X bytes exhausted.” It might appear as text on a blank page, or WordPress may catch it first and show “There has been a critical error on this website.” Either way, a script consumed all the PHP memory your server allocated, and PHP stopped before the page could finish loading. The number in the error is in bytes. 33554432 bytes is 32MB. 67108864 is 64MB. If you see either of those, your memory limit is almost certainly set too low for the plugins you’re running.

Check your current limit first #

Before changing anything, go to Tools > Site Health > Info > Server and find the PHP Memory Limit listed there. If it reads 32MB or 64MB, that’s the likely cause. If it already reads 256MB or higher and you’re still hitting the error, the problem isn’t the overall limit. A specific plugin is consuming an abnormal amount of memory during a specific operation, and the fix is identifying and replacing that plugin rather than continuing to raise the ceiling.

Raising the memory limit #

Add this line to your wp-config.php file, above the line that reads “That’s all, stop editing!”: define('WP_MEMORY_LIMIT', '256M');

Save the file and reload the page that was showing the error. If it recovers, the limit was the problem. If the error persists, your hosting provider has set a hard cap that wp-config.php can’t override. Contact them and ask them to raise the PHP memory_limit for your account. On most shared hosting plans, 256MB is reasonable to request. Managed WordPress hosts typically have this set appropriately by default.

How Loupely identifies which plugin is consuming memory #

When a memory exhaustion error happens during a specific action (loading a product page, running a bulk operation, saving a post), Loupely’s PHP error capture includes the file path and function where PHP stopped. That path almost always names the plugin responsible. A memory exhaustion error in /wp-content/plugins/woocommerce-product-import/... tells you exactly where to look without requiring you to deactivate plugins one by one. Run a Loupely diagnosis on the page or action that triggers the error and the capture will include that detail.

If raising the limit doesn’t help #

A site that regularly exhausts 256MB of PHP memory has either an unusually large number of active plugins, a plugin with a memory leak, or a hosting environment that’s underpowered for the site’s workload. Deactivate plugins you don’t actively use. A plugin that’s installed but not doing anything you care about is still loading code and consuming memory on every page request. Twenty plugins doing twenty small things adds up.