Link to home
Start Free TrialLog in
Avatar of Manoj Chacko
Manoj Chacko

asked on

PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted

Hi

I keep getting the below error, I have a pretty big wordpress site with so many plugins
Is their anyway to diagnose what causing this error and fix it.

[23-May-2018 19:46:38 UTC] PHP Fatal error:  Allowed memory size of 1610612736 bytes exhausted (tried to allocate 20480 bytes) in (...)\wp-includes\class-wp-hook.php on line 271
[23-May-2018 19:46:38 UTC] PHP Fatal error:  Allowed memory size of 1610612736 bytes exhausted (tried to allocate 45056 bytes) in (...)\wp-includes\functions.php on line 3730
[23-May-2018 19:46:41 UTC] PHP Fatal error:  Allowed memory size of 1610612736 bytes exhausted (tried to allocate 67108872 bytes) in (...)\wp-includes\plugin.php on line 195
[23-May-2018 20:02:09 UTC] PHP Fatal error:  Allowed memory size of 1610612736 bytes exhausted (tried to allocate 262144 bytes) in (...)\wp-includes\plugin.php on line 201
[23-May-2018 20:02:09 UTC] PHP Fatal error:  Allowed memory size of 1610612736 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0
[23-May-2018 20:02:09 UTC] PHP Fatal error:  Allowed memory size of 1610612736 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0
[23-May-2018 20:02:11 UTC] PHP Fatal error:  Allowed memory size of 1610612736 bytes exhausted (tried to allocate 67108872 bytes) in (...)\wp-includes\plugin.php on line 195

Thanks
Manoj
ASKER CERTIFIED SOLUTION
Avatar of gr8gonzo
gr8gonzo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Have you determined whether this is a memory leak or just a site that needs more memory than is available.

You might want to look at upping the memory limit in the PHP.ini (or .htaccess) file.
Just some context here - I believe he used to have a 1 gig limit and he apparently increased it to 1.5 gigs. He's recently upgraded WP from apparently a pretty old version, since some of his problematic plugins haven't been tested since the 3.x versions of WP. There's at least one plugin that is calling hooks in the wrong order.

I'd investigate plugin problems before upping the memory limit. You don't want to just see that it's "fixed" at 2 gigs of memory and leave it at that, which basically would result in terrible performance and throughput. The time it takes to allocate that much data into memory already means poor performance and an inability to scale well. Its one thing if it's happening as a one-off scenario (e.g. a data import that has exceptionally large data fields), but this shouldn't be a regular thing.
I'd investigate plugin problems before upping the memory limit
I totally agree - but let's say he find's plugin x is chewing a lot of RAM - then what? Remove it / replace it / fix it? Often not a lot of choice.
There are two potential issues.
1. Something is leaking memory
2. There is not enough memory to do what he wants.

WordPress is a terrible platform to begin with - trying to fix things is always going to be a pain. We went through this recently running the WeaverXtreme theme - kept crashing when we tried to go to certain pages. Eventually we upped the memory limit and that sorted it - I was personally not happy about it but the people who built the site decided on the WeaverXtreme theme and then tried to make it do everything under the sun - it was either up the memory or redo the site.
WordPress is a terrible platform to begin with
I used to think that, too, but I've slowly changed my mind over time. It's really not WP that is terrible but all the shoddy plugins and themes. WP can fly pretty quickly with a little optimization. But when you get people who are primarily designers that are creating entire themes and adding lots of heavy dynamic options like hitting FB/Twitter/Instagram APIs to fetch share counts without any sort of caching, that kind of stuff just melts it all down.
Avatar of Manoj Chacko
Manoj Chacko

ASKER

A modified version of this code worked. This was generating a lot of logs so was hard to find the one that causes the issue. so I put in an if statement around it to log only if the memory used is above my max limit. and that worked showed me exact plugin that was causing it.