Hey guys, in the following code:
def process(batch_size=1000)
claim_numbers.each_slice(batch_size) do |numbers_batch|
claims = Claim.find(:all, :conditions => ["claim_number in (?)", numbers_batch])
# do something with claims
end
end
In one of my Rails models I'm processing a lot of claim_numbers
, I'm simulating a find_in_batches
method in order to do not load a lot of records into memory, then my question is: in terms of memory, what happens with the claims
variable in each iteration? when does the Ruby's GC release that portion of memory?
Any help and tips would be appreciated, thanks in advance!
Update: Using Ruby 1.8.7-p72