node_delete() is not deleting nodes I'm trying to use a drush function to flush out all of the drealty module's nodes in my drupal 6 install.  However, something is causing a memory leak and the nodes are not being deleted after node_delete is called.  What can I do?

Here is the memory exhausted error:



drush rets-flush
PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 71 bytes) in /home/directory/public_html/sites/all/modules/filefield/field_file.inc on line 300
Drush command terminated abnormally due to an unrecoverable error.   [error]
Error: Allowed memory size of 134217728 bytes exhausted (tried to
allocate 71 bytes) in
/home/directory/public_html/sites/all/modules/filefield/field_file.inc,
line 300


Here is the drush rets-flush function:



function drush_drealty_rets_flush() {
  set_time_limit(0);

  $result = db_query("SELECT nid FROM {node} WHERE type = 'drealty_property' OR type = 'drealty_agent' OR type = 'drealty_office' OR type = 'drealty_open_house'", $conid);

  $count = 0;
  while ($nid = db_fetch_object($result)) {
    node_delete($nid-&gt;nid);
    drush_log(dt('Deleting node id: @nid. ', array('@nid' =&gt; $nid-&gt;nid)));
    $count++;
  }
  drush_log(dt('Deleted @count nodes', array('@count' =&gt; $count)), 'success');
}


There are about 5000 records total.
Found the answer myself.  I had to run drush as admin: 



drush -u admin rets-flush


I thought drush ran as admin automatically, but I guess not.