WordPress Fatal Error: Allowed Memory Size Exhausted
Critical Frequency: CommonError message:
Fatal error: Allowed memory size of X bytes exhaustedThe ‘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
- Plugin using excessive memory (image processing, imports, page builders)
- Too many plugins active simultaneously
- Theme with heavy template processing
- PHP memory_limit set too low in php.ini (32MB or 64MB)
- Memory leak in a plugin or theme (grows over time)
How to Fix It
- Increase WP memory limit: Add
define('WP_MEMORY_LIMIT', '256M');to wp-config.php - Increase PHP memory_limit: Set
memory_limit = 256Min php.ini or .htaccess:php_value memory_limit 256M - Identify the memory-hungry plugin: Deactivate plugins one by one and monitor memory usage
- Use WP-CLI to check:
wp eval 'echo memory_get_peak_usage(true);'to see peak memory - Optimize images before upload u2014 large image processing is a common memory hog
- 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.