How can I keep a long-running Drush script from gradually exhausting available RAM?
You could use the Drupal batch API and call it from Drush.  You could use the Drush batchTest unit test as another reference on how to use the batch API from Drush.