WP_Query leaking absurd amounts of memory

Excellent responses on WP Hackers:
http://lists.automattic.com/pipermail/wp-hackers/2012-June/043213.html

What you’re doing with that query, is loading EVERY matching post into
memory, including the full post contents.
As you can imagine, this is probably quite a lot of items.

You can pass ‘fields’ => ‘ids’ into WP_Query to simply return a list
of matching post_ids instead, which should reduce the memory (and
processing time) significantly:

http://codex.wordpress.org/Class_Reference/WP_Query#Post_Field_Parameters

Leave a Comment