Fatal error: Allowed memory size of 33554432 bytes exhausted
We were having trouble with a site’s memory limits. We had a dozen or so plugins running, but nothing out of the ordinary, and we kept hitting memory limits. Even on the WordPress Dashboard, the Incoming Links and the RSS Feed had the same “Allowed memory size of xxxxxx bytes exhausted.” Even more important, we couldn’t install new plugins or upgrade WordPress. I’ve been around the block trying to increase memory for the NextGen gallery, but this was just everywhere.
Here’s a quick link to the solution.
I did the usual fixes, as far as you can do on shared or reseller hosting. I even found a really cool plugin called TPC! Memory Usage that showed me what the PHP memory usage was on the server. Pretty graph that went from green to yellow to red as I added more plugins. I deactivated all plugins and then activated them one by one. Pretty soon I was at 96% of resources. The technical sysadmin in me said, “Hmm, that seems like a lot.”
WordPress: wp_update_post returns Error “Allowed memory size exhausted”
Posted by: admin December 2, 2017 Leave a comment
After the call of wp_update_post($my_post) I checked memory_get_usage(). With every call in a post update inside a foreach loop the memory usage is getting higher and higher.
Here are the outputs from echo memory_get_usage(); which I did after wp_update_post():
1st call= 72923956
2nd call= 89410604
3rd call= 105152440
4th call= 120900116
5th call= 136651592
6th call= 152432716
7th call= 168178896
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 15728640 bytes) in …/wp-includes/wp-db.php on line 1196
My question is:
Is there a possibility of flushing the memory, delete the content of the $my_post arrays which I built for wp_update_post()? By the way: The size of the arrays are appx 1000 characters each…
Here is a generalized code. You can search for “wp_update_post” to find the line with the memory problem.
Thanx for helping,
I am not sure of the exact reason but you can try to unset $xml variable once the loaded file has been processed, similarly try removing large variables( file_get_contents returns ) when no longer in use. This could lower the memory requirement for each for loop.
WordPress wp-admin fatal error allowed memory size of
Allowed Memory Size Exhausted
I started getting the following errors on the frontend of a WordPress site:
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 12288 bytes) in /home/aginginoudoun/public_html/wp-admin/includes/theme.php on line 523
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 3072 bytes) in /home/aginginoudoun/public_html/wp-content/plugins/sabai/lib/Sabai/Addon/System/Model/Base/AddonGateway.php on line 81
A Google search indicated that the software was reaching a PHP memory limit, so I ran a phpinfo.php and saw that both local and master memory was 64M. Further reading advised creating a .user.ini file, put the following line in it: memory_limit = 256M, and place the file in the public_html folder. So I did this, and ran phpinfo again and saw that local memory was now 256M and master was still 64M. Supposedly the local overrides the master value.
Tested the website again, and no more fatal errors!
wordpress update / fatal error
i’ve just updated wordpress and now seem to be locked out of my site. no matter what i try, im getting an error similar to the following:
the only thing that changes is the events calendar directory that the error points to. now, the front end of my site seems to be ok (which im super confused by) so im not in utter panic. that said, i still need to get into the admin section of my site and have no idea what to do.
I’m really sorry to hear about this!
I looked at the lines of code referenced in this errors and am a bit puzzled about these errors — I certainly don’t see a pattern in what might be causing the errors, for example. We also don’t have any reports of these errors from other customers.
So, with this in mind I would recommend the following steps:
- First, contact your web hosting provider and request an increase of the allowed memory size for your WordPress installation. If you are managing your server on your own, there is a good guide for increasing these values from WPMUDev here.
- If increasing the limits lets you get into your site’s wp-admin, then while you’re in there can you please get your site’s System Information and share that with us? Here is how to do that → https://theeventscalendar.com/knowledgebase/sharing-sys-info/
- If increasing the limits does NOT help, then I would recommend accessing your site’s server via FTP and deleting the /events-calendar-pro directory from /wp-content/plugins. This will NOT erase any event data. Once Events Calendar Pro is gone from your site, try accessing the wp-admin again.
- If these steps let you get into the wp-admin, can you then share the system information as recommended above? And per these instructions: https://theeventscalendar.com/knowledgebase/sharing-sys-info/
Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team