Within WordPress, the WP_Query
class can be called with certain arguments to retrieve posts (data) from your database. Unforunately the object itself is big and if it retrieves 300-400 posts, it gets hectic pretty fast because, assume you store this WP_Query
and its newly found posts in an array, it gets big pretty fast, I can see that it eats up ~30-40mb of my memory on local host which is already a powerful machine, so I decided to test on my server machine, a bit lower memory usage since it's running Linux but still the same.
Now, imagine I had 800 posts. This is a very, very real and often met possibility, heck, I saw a lot of customer sites with more posts.
Obviously, my script will exceed, first, the execution time on a bad host and second, if it ever reaches here, memory exhaustion.
I kind of know how to solve it and had very good success but I went in totally blind, just looking at the differences between the task manager's memory consumption.
Are there no tools that map the memory consumption of a certain script together with its execution time? XDEBUG only shows execution time.