Closed SimpleKjell closed 6 years ago
Now that's a really weird one didn't not investigate why but your way of tracking leads to very different results (depending on wether wp cron runs or not and other factors it seems) but using query monitor i got reproducible values!
in the example there are 29 calls of pods_group_add:
editing an entry of the CPT imobilie
increases by about 10MB the memory usage in the admin
editing an entry of any post type - memory usage increased by about 10 MB
each run of wp_insert_post() increases memory usage by 10MB
seems each usage of pods_group_add() increases the memory!
@SimpleKjell simple workaround depending on how/where you do the import is only loading the pods_group_add() conditionally e.g for the shortcode:
if ( is_admin() ) { add_action( 'pods_meta_groups', 'pods_metaboxes_add_function', 10, 2 ); }
PS: Hallo aus Wien ;)
Oh and define( 'SAVEQUERIES', false ); help's to depending on your settings/tools
Good find, I will look at this today/tonight and see if I see anything out of the ordinary in this section of the code.
At first glance, adding groups should not exponentially effect wp_insert_post calls, especially consecutively. Somewhere something must be setting up but not tearing down. I’ll get on it, but again thanks for the heads up.
Side note: this is an area getting massive love in Pods 2.8 as we open up our Admin UI to define new field groups.
I've got some code that helps address the memory usage problems here, should resolve it rather completely.
PR: https://github.com/pods-framework/pods/pull/5101 Zip: https://github.com/pods-framework/pods/archive/feature/5088-groups-static-cache.zip
@SimpleKjell: This could use testing to assure it resolves the problem, otherwise it's ready to merge into 2.x and make the next release.
Im Using: WP: 4.9.7 PODS: 2.7.8 No additional Plugins installed. Just Pods and a single file plugin.
Describe the BUG
Hey there, it took me hours and hours of debugging to get into this. I was one sec before trashing my whole code, then i found the following.
To break my task down into a minified version:
I want to insert many posts by
wp_insert_post()
The Problem occurred:
Memory Limit reached
To Reproduce Steps to reproduce the behavior:
test_short
to a pagepods_meta_groups
out and reopen the pageExpected behavior Without the
pods_meta_groups
the memory usage cleans up after each instered post. By addingpods_group_add
its adding up memory. The morepods_group_add
added the more memory is increasing.Screenshots With Pods Group Add:
Without Pods Group Add:
![memory-without-podsgroupadd](https://user-images.githubusercontent.com/23497796/43577068-1f9aa782-964b-11e8-8cb3-dd08ce710cec.png)
Pods Version
Please provide the version of Pods you are running: 2.7.8
WordPress Environment
Pods Package Export (helpful!)
Never forget - pods is awesome!
Plugin to install and output: test.zip