WordPress Fatal Error: Allowed Memory Size Exhausted

Critical Frequency: Common
Error message: Fatal error: Allowed memory size of X bytes exhausted

The ‘Allowed memory size exhausted’ error occurs when a PHP script tries to use more memory than the limit allows. WordPress has its own memory limit (WP_MEMORY_LIMIT) on top of PHP’s memory_limit setting.

The default WordPress memory limit is 40MB for the frontend and 256MB for admin. Many hosts set PHP memory_limit to 128MB or 256MB. If a single page request needs more than this, you’ll get this fatal error.

Common Causes

  1. Plugin using excessive memory (image processing, imports, page builders)
  2. Too many plugins active simultaneously
  3. Theme with heavy template processing
  4. PHP memory_limit set too low in php.ini (32MB or 64MB)
  5. Memory leak in a plugin or theme (grows over time)

How to Fix It

  1. Increase WP memory limit: Add define('WP_MEMORY_LIMIT', '256M'); to wp-config.php
  2. Increase PHP memory_limit: Set memory_limit = 256M in php.ini or .htaccess: php_value memory_limit 256M
  3. Identify the memory-hungry plugin: Deactivate plugins one by one and monitor memory usage
  4. Use WP-CLI to check: wp eval 'echo memory_get_peak_usage(true);' to see peak memory
  5. Optimize images before upload u2014 large image processing is a common memory hog
  6. Consider upgrading your hosting plan if you're on shared hosting with low memory limits

Frequently Asked Questions

How much memory does WordPress need?
WordPress core needs about 30-40MB. With plugins, 128MB is a safe minimum, 256MB is recommended. Some page builders and WooCommerce stores may need 512MB.
Is increasing memory limit a real fix or just a bandaid?
Increasing the limit fixes the immediate error, but if you're hitting 256MB+, investigate which plugin is consuming the most memory. A well-optimized site should run under 128MB.
Get WordPress Performance Tips

Plugin reviews, speed optimization guides, and error debugging — straight to your inbox.

No spam. Unsubscribe anytime. We respect your privacy.