[Resolved] Fatal error: Allowed memory size of X bytes exhausted
This thread is resolved. Here is a description of the problem and solution.
Problem: If you're experiencing a memory size error when updating a post with a significant number of ACF fields using Advanced Custom Fields Multilingual, and the issue does not occur when the plugin is deactivated, it might be due to database corruption. Solution: We recommend taking a full backup of your site and then checking the database for any inconsistencies or corruption. In this specific case, the issue was traced back to a corrupted entry in the 'postmeta' table for the file field 'installation_manual' in the 'Post type - Product' field group. Deleting the corrupted entries and re-updating the product resolved the issue.
Please note that this solution might be irrelevant if it's outdated or not applicable to your case. We highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the problem persists, please open a new support ticket.
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
Background of the issue:
I am trying to update a post with a significant number of ACF fields using Advanced Custom Fields Multilingual. When attempting this, I encounter a memory size error. The issue is specific to Advanced Custom Fields Multilingual, as it does not occur when the plugin is deactivated. My environment details are: WordPress version 6.4.4, ACF Pro version 6.3.0.1, WPML version 4.6.11, Advanced Custom Fields Multilingual version 2.1.3, PHP version 7.4.33, and a memory limit set in php.ini of 4096M. The URL where the issue can be seen is hidden link.
Symptoms:
Fatal error: Allowed memory size of 4294967296 bytes exhausted (tried to allocate 4096 bytes) in /html/wp-includes/class-wp-hook.php on line 329. The product should save without any error, but I am getting a memory size error instead.
Questions:
Why am I encountering a memory size error when updating a post with a significant number of ACF fields?
How can I resolve the memory size error specific to Advanced Custom Fields Multilingual?
After taking a full back up and restoring your site on my localhost to investigate the issue, I found it is database corruption and related to the file field "installation_manual" in the field group "Post type - Product".
When editing the product 1101258, you can see there isn't a file field value but checking in the database, table postmeta, it has value as well. So I delete the entries in the database, re-update the product and it works properly. Please check the attached screenshots.
It's a database corruption issue so it's hard to understand how this occurs, maybe the selected file doesn't exist or was deleted. I also cannot replicate the issue by creating a new product and update. If the issue occurs again, feel free to contact us by opening a new ticket, we will be happy to help you resolve the issue on your site.