How many records a WP_Query can handle ?

Hello everyone.
I'm doing a wp_query to retrieve some posts from our site.

Actually I want to retrieve posts from a specific category that have not been updated in the past six months.
I'm building a notification mechanism which will run every month

My query is the following

function filter_where_modified_six_months($where = '') {
    $where .= " AND post_modified < '" . date('Y-m-d', strtotime('-6 months')) . "'";
    return $where;

  function edit_posts_orderby($orderby_statement) {
    $orderby_statement = " post_author asc, post_modified desc";
    return $orderby_statement;

  add_filter('posts_orderby', 'edit_posts_orderby');
  add_filter('posts_where', 'filter_where_modified_six_months');

  $meta_ideas = array(
    'nopaging' => true
    , 'post_status' => 'publish'
    , 'category_name' => 'ideas'
  $query_ideas = new WP_Query($meta_ideas);
  $ideas_temp = $query_ideas->get_posts();
  remove_filter('posts_where', 'filter_where_modified_six_months');
  remove_filter('posts_orderby', 'edit_posts_orderby');

This gives me
Allowed memory size of 41943040 bytes exhausted
$query_ideas = new WP_Query($meta_ideas);

If I do pagination, then I can get up to 200 records.

Total records are 317, which are not too many to retrieve.
Am I doing something wrong? Could you suggest any alternatives?