🔥 Limited Time Offer: 37 Premium Readymade WordPress Websites Agency Bundle Kit worth ₹9,99,999 — now just ₹29,999 ⏳ Order Now
How to Fix Memory Exhausted Error in WordPress
How to Fix Memory Exhausted Error in WordPress
Seeing the “Allowed memory size exhausted” or “Fatal error: Out of memory” message? This error occurs when WordPress, a plugin, or a theme uses more RAM than your hosting server has allocated. In this full guide, learn how to fix the memory exhausted error permanently—even on shared hosting.
What Causes the Memory Exhausted Error?
WordPress hits its assigned memory limit and stops execution.
This error usually appears as:
Fatal error: Allowed memory size of 134217728 bytes exhausted
It happens due to:
- Heavy plugins (e.g., Elementor, WooCommerce)
- Memory-hungry processes (imports, backups)
- Faulty themes
- Low server memory
- Too many active plugins
- PHP memory limit too low (common on shared hosting)
The good news: it can be fixed in minutes.
Step 1: Increase WP Memory Limit via wp-config.php
This is the quickest & most reliable fix.
Edit wp-config.php and add this line above “That’s all, stop editing!”:
define( 'WP_MEMORY_LIMIT', '512M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );
Recommended values:
- 256M → Minimum for WooCommerce sites
- 512M → Best for Elementor + WooCommerce
- 1024M → For VPS/Cloud hosting
Step 2: Increase Memory in PHP INI / Server Settings
Some hosts override wp-config settings.
Increase memory using hosting tools:
cPanel:
- Software → MultiPHP INI Editor
- Find memory_limit
- Set to 512M or more
php.ini (manual):
memory_limit = 512M
.htaccess:
php_value memory_limit 512M
Cloud hosting (RunCloud / CyberPanel):
- PHP Config
- Increase memory limit
If your host limits memory to 128M or less → consider upgrading hosting.
Step 3: Disable Heavy or Faulty Plugins
Bad plugins over-consume memory and cause fatal errors.
If you cannot access WordPress admin:
- Open File Manager → /wp-content/
- Rename plugins → plugins-disabled
- Your site loads without plugins
Then activate plugins one by one to find which one triggers memory spikes.
Plugins known to trigger memory issues:
- Elementor + Elementor Pro
- WP Bakery (old versions)
- WooCommerce (large stores)
- Backup plugins (running jobs)
- Image optimization plugins
- Security scanners
Avoid installing overlapping functionality plugins.
Step 4: Switch Temporarily to a Default Theme
Bad theme code can create infinite loops consuming memory.
Steps:
- Go to /wp-content/themes
- Rename active theme
- WP activates Twenty Twenty-Four automatically
If the site works → theme was causing the memory error.
Step 5: Increase Server Resources (If Using Shared Hosting)
Some hosts limit RAM too much for modern WordPress setups.
Upgrade if you’re running:
- WooCommerce with 20+ plugins
- Elementor templates
- Heavy themes like Porto, WoodMart, Flatsome
- Large product catalogs
Recommended hosting environment:
- 1–2 GB RAM minimum for WooCommerce
- 2 GB+ RAM for Elementor-heavy websites
- Cloud hosting (Vultr / DigitalOcean / Linode) for large sites
Step 6: Fix Memory Leaks in Plugins/Themes
Some plugins continue increasing memory usage until the site crashes.
Signs of a memory leak:
- Site loads slowly over time
- Crash occurs after some minutes
- High CPU usage
- Memory goes from 128M → 256M → 512M continuously
Fix:
- Disable suspicious plugins
- Check debug.log
- Update everything to latest version
- Replace poorly coded plugins
Step 7: Clear All Caches (Server, WordPress, CDN)
Cached PHP processes may still run outdated memory-hog scripts.
- Clear LiteSpeed cache
- Clear Cloudflare cache
- Clear WP Rocket / W3TC cache
- Restart PHP in your hosting panel
This helps reset memory allocation.
Step 8: Check Error Logs for Exact Memory Issue
WordPress won’t show detailed errors unless debug is enabled.
Enable debug logging:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
Check:
/wp-content/debug.log
This will show which plugin/theme consumes excessive memory.
Step 9: Fix File Permission Issues
Incorrect permissions can cause infinite loops → memory overload.
Correct permissions:
- Folders: 755
- Files: 644
- wp-config.php: 600
Want a High-Performance WordPress Website?
All SiteCrafted ready-made websites come optimized for memory usage, high performance, stable plugins, and cloud hosting for smooth, error-free operation.