AR, find(:all), loops and memory usage

(I tried posting this before, but after several hours it has not
appeared on the list, if a dupe shows up i’ll delete one)

I’m a beginning programming using ActiveRecord outside of Rails to do
conditional processing of database records. So far, I’ve been
successful. However, my script loads all matching records into memory
first. There are hundreds of thousands of matching records so the
script quickly consumes over 500MB of RAM before any processing is
done. Is there a way to avoid this preloading of row objects in memory?
Below is an example of the type of thing I’m trying to do (although the
actual table row-level processing I’m doing is more complicated than
the example, but this isn’t relevant to my question):

#example code
require ‘rubygems’
require ‘mysql’
require ‘active_record’

ActiveRecord::Base.establish_connection(
:adapter => “mysql”,
:username => “root”,
:password => “password”,
:database => “my_schema”
)

class MyTable < ActiveRecord::Base
end

for m in MyTable.find(:all, :conditions => “some_column=‘criterion to
match’”)
m.other_column = “new value”
m.save
end
#thanks for any tips