ruby on rails 3 - Getting OutOfMemoryError: GC overhead limit exception when using ActiveRecord::find_in_batces (20 records a time) -


i using: rails 3.0.7 jruby 1.6.7 (ruby-1.8.7-p357)

and trying process ~360k db records in batches of 20, following:

backjobs.find_in_batches(:conditions => "progress = -1", :batch_size => 20) |all_pending_jobs|     all_pending_jobs.each |job|         pending_jobs.push(job)     end 

however keep getting exception after time:

activerecord::statementinvalid: java::javalang::outofmemoryerror: gc overhead limit  exceeded: select  "background_jobs".* "background_jobs" (progress = -1)  , ("background_jobs"."id" > 45256) order "background_jobs"."id" asc limit 20 

the process runs jvm settings: -xmx256m -xss2048k

as far understand, active_record.identity_map not supported until rails 3.1.0 ruby on rails memory leak when looping through large number of records; find_each doesn't help

but using activerecord::unchached not help..

not sure if should/how destroy activerecord objects free memory. please advise. thanks.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -