I’ve been trying to setup some product data using ACF.
I created a custom product post type, and then created the ACF fields I’d need. In total, it’s about 20 fields, though 4 of those are repeaters (1 image, 1 file & 1 test repeater).
Everything works fine, until I actually try to input data and save a custom post. Sometimes saving a post works, but then only the 1st custom field loads when I try and edit the post.
I traced this down to a PHP memory error:
[Tue Jan 21 15:40:50 2014] [error] [client 188.8.131.52] PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 128 bytes) in /var/www/wp-content/plugins/advanced-custom-fields/core/fields/text.php on line 231
So, I upped my php memory limit to 1024M (out of 2GB available). That almost worked, but then led to a max execution time error:
[Tue Jan 21 16:01:07 2014] [error] [client 184.108.40.206] PHP Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/wp-content/plugins/advanced-custom-fields/core/fields/_functions.php on line 119
At that point, I gave up on PHP, and figured Nginx might fare a bit different. After moving everything over to a Nginx server, I tried the same process, and got the same result.
So – am I simply overwhelming what ACF can handle, or is there some other solution that I should try before I give in?
Just an update:
I thought perhaps this was due to a conflict with the “Types” plugin I’d been using to create custom post types. So I disabled that plugin, and manually added the post type to my functions.php.
This changed nothing.
I’m working with a blank install, with ACF as my only plugin.
Sounds like the code you have written is very memory intensive and is taking a very long time to complete.
Double check that you do not have an infinite loop.
Thanks for the reply. When you say, “the code you have written”, are you referring to the custom fields I’ve created through ACF, or something else? This is a blank WordPress installation, with ACF as the only plugin, using the default TwentyThirteen theme. The only modification I’ve made to the theme is adding the custom post type in the theme’s functions.php.
I too am having this same issue as of the latest update of ACF. I get
[24-Jan-2014 15:56:11 UTC] PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 1848526505 bytes) in /var/www/wp-content/plugins/advanced-custom-fields/acf.php on line 388
Can you please list the plugins you have activated and the theme you are using?
Is it possible for you to disable these other plugins and theme to test ACF on your server? This will help rule out any conflicts.
Also, are you able to work on a local server? Perhaps the server you are using does not allow for many DB connections and doesn’t play nicely with WP + ACF.
I’ve the same problem with the ACF Repeater activated, is there any news about the solution of this issue? Please let me know.
Same issue here. I’m running a Flexible Content field within a nested Repeater Field. So that’s REPEATER -> REPEATER -> FLEXIBLE CONTENT.
The client kept adding content to the page, until eventually it just wouldn’t allow anymore and gave this fatal error.
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 72 bytes) in /public_html/wp-includes/meta.php on line 575
Increasing the WP_MAX_MEMORY_LIMIT to 512M “fixes” the problem, but loading this admin page and updating it take a LONG time. I’m very concerned that increasing the WP_MAX_MEMORY_LIMIT is just a band-aid. Why would it be taking up so much memory? Is ACF just not designed for using it this way? I sure hope not…
No other plugins running.
By creating such a large custom field, and by allowing your client to save so much complicated data, you are asking WP and ACF to perform a lot of complicated logic that WP was never built to do.
Please take this into consideration when looking for a solution to your memory issue.
Perhaps you have other plugins which are using up memory?
Perhaps your theme contains some code which is using up memory?
I would increase your memory limit for now, and think about optimizing your code.
Perhaps such a nested repeater field would be better broken up into individual post objects. This will allow you to save smaller chunks of data.
One really easy way to get a timeout/out of memory error is to forget to call
the_row(); in your
while ( have_rows( <fieldname> ) ) loop. That means that the row counter doesn’t advance and you get into an infinite loop.
‘scuse me if that’s obvious – I just got asked to debug someone’s template and that was the problem.
I’m seeing the same issue, but this is strictly on the admin area when editing a post. This is the error i get:
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 32 bytes) in /Users/matthewlane/Dropbox/Work/Websites (MAMP)/Commercial/www.yournextyoga.com-members/wp-content/plugins/advanced-custom-fields/core/fields/text.php on line 231
Now, this has literally just occurred for me, i added a new repeater into one of my field groups already created (i have around 90 other field groups, with a few repeaters in those as well) at most i have only 6-8 field groups active at a time with no more than 3 repeaters within those groups (6 groups, max 3 repeaters at any one time).
The field groups are being used on my own custom post types, and up until this point have all been fine. I’ve raised my PHP memory limit right up to 1024m and increased the script timeout to 60 – to be honest I would rather they were back to some acceptable defaults – mind you neither is having any effect.
I am running this right now on my local mamp server, so its not online as if i can’t get this running locally no point in going online with lower defaults for memory and script timeout.
Any suggestions – as i said this is only while editing a post, and after adding a single additional repeater to one of my field groups.
Am i pushing ACF to far with so many groups – but considering what i have seen others suggest they have done (google told me…) I’m not even close to that.
Thanks in advance.
I’m having this same issue as well. The error started to occur once I had hit a certain point in the number of elements I had in the post. Smaller posts continued to work fine, a longer post with five or six flexible content rows breaks.
I’m using WordPress 3.9 and have Flexible Layout as well as Repeater fields. I also have a couple of relationship fields, which I know are also resource intensive.
I guess what I would add to this question is – is this issue a resource limitation issue, or is there a loop happening because of the combination of addon plugins and fields that needs to be optimized?
is there no answer to this problem? I am having the same issue
Hi Everyone – I had this issue on the edit page and it only recently occurred. I realise this occurred just after I imported 100’s of post-types into WordPress and I had a field that was looking up the available pages for links. In fact I had this on a repeater.
Elliot – Any ideas if this can be ajax-ified so these pages are fetched when required we don’t run into these memory issues? Or perhaps another way to index links so this doesn’t cause an issue?
Everyone else – Either change the look up to be a text field and enter this manually or a bad compromise is to increase the memory limit: http://stackoverflow.com/questions/21680244/fatal-error-allowed-memory-size-of-268435456-bytes-exhausted-tried-to-allocate
Hope that helps
hey Eliot i agree with raison at least in my case this is caused not by repeater but by post object or page link fields on a very large site so i think its a scaling issue i work on a news type site with more than 20000 posts god knows how much draft posts and custom posts and trying to get the post object or page link is breaking the memory limit even on 512 but when i use relationship field to return the post object it works perfectly cause it uses ajax and doesnt load all the post the only problem i have is that relationship fields allow multiple selection i limit it to one in the front end but its not looking good on the backend so my suggesstion would be using a ajax way for post object and page links or having a relationship field that can only select one that would be awesome cause i love the search and filter by post type functionality of it
I have the same problem. I have created a repeater field that is used on the_front_page, where the admin can insert google map coordinates. The admin has inserted over 200 fields of coordinates which results in a Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 32 bytes).
Memory is set to 256MB in the wp-config.php and on server, so there should be plenty of memory.
This issue only appears in the backend, editing the page.
I am using ACF Version 4.3.9 and ACF repeater field Version 1.1.1.
Is there a chance that ACF Version 5.1.5 will run better regarding this?
In my case, it was solved by raising the memory limit in the server.
@vayu, have you checked with a phpinfo(), that you are actually running 256mb? If so, and just for testing, try raising the limit and see if that helps. It might be that it is a memory problem.
Just to chime in – increasing memory limit will solve to a degree, but we had an enormous site and even if we maxed out the memory limit we still had issues.
A better solution would be to limit the lookup so the server does not max out. Hopefully Elliot and the ACF team will consider adding some functionality to address this
I faced this problem, and tried upping my memory limit, which fixed the problem for a time. But it came back asking for more memory!
That’s when I did more research and realized it wasn’t the memory that was the problem, but the fact that WordPress preloads the postmeta in the WordPress admin. So if you have a lot of custom fields associated with your posts, it’s going to take up a lot of memory.
I’ve written a blog post on what causes this, and how to fix this problem:
I have issues, while saving a page with many fields (at the backend). It sometimes takes up to 16 seconds or more, until the page is saved.
I tested something and find out, if I deactivate the WordPress revisions, the issue is gone.
define('WP_POST_REVISIONS', false );
Apparently the matching of the many fields takes very long time.
AND @junaidbhura above offers a WONDERFUL solution also!
All nested repeater memory hog issues are now a thing of the past!!
This should be in the ACF documentation!
The topic ‘Memory Exhausted at 256M -> 30s Timeout at 1024M’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
Last but not least, we built a 100% PHP based Gutenberg Block API designed specifically for theme developers in the real world creating bespoke and maintainable blocks for future driven projects!https://t.co/bx8HrCwkjF— Advanced Custom Fields (@wp_acf) May 31, 2021
❤️ 10 of 10 pic.twitter.com/OacUqWGrZZ
© 2021 Advanced Custom Fields. Subscribe