title: Cron job running out of memory very fast
body: <p>I am hosted on godaddy shared hosting.  My database has over 500 entries, but I expect it to be much higher as time go on.  Maybe in the thousands.  I have this running as a cron job, but it runs out of memory (64 megs) after only 33 records.  I can not change the max memory since I am on shared hosting.  Is there anything I can do to reduce the memory usage?  Perhaps any way to clear the memory each time it loops?</p>
  
  <pre><code>include('simple_html_dom.php');
  $html = new simple_html_dom();  
  
  $price_query = mysql_query("SELECT * FROM prices");
  while ($price_rows = mysql_fetch_assoc($price_query))
  {
  $vendor_id = $price_rows['vendor_id'];
  $product_id = $price_rows['product_id'];
  $product_page = $price_rows['product_page'];
  $product_string = $price_rows['product_string'];
  $product_array = $price_rows['product_array'];
  
  if (urlOK($product_page))
      {
      $html = file_get_html($product_page);  
  
      $new_price = $html-&gt;find($product_string); 
      $new_price = preg_replace('/[\$,]/', '', $new_price);
      $product_price = $new_price[$product_array];
      $product_price = strip_tags($product_price);
  
      $qry="UPDATE prices SET product_price='$product_price' WHERE product_id = '$product_id' AND vendor_id = '$vendor_id'";
      mysql_query($qry);
      }
  
  else
      {
      $qry="UPDATE prices SET product_price='0.00' WHERE product_id = '$product_id' AND vendor_id = '$vendor_id'";
      mysql_query($qry);
      }
  
  $vendor_id = null;
  $product_id = null;
  $product_page = null;
      $product_string = null;
      $product_array = null;
  $qry = null;
  $html = null;
  }
  </code></pre>
  
  <p>This is the 1 function im calling:</p>
  
  <pre><code>function urlOk($url) 
  {
      $headers = @get_headers($url);
      if($headers[0] == 'HTTP/1.1 200 OK') return true;
      else return false;
  }
  </code></pre>