Rails 4 Error R14 on Heroku (Memory Quota Exceeded)
If Papertrail is causing a problem, try a different add on. I've been using LogEntries without much of a problem. https://addons.heroku.com/#logging
Also try to lower your Unicorn worker processes so it uses lower total memory. Instead of the default of 3 (per box/dyno), try 2.
https://devcenter.heroku.com/articles/rails-unicorn#unicorn-worker-processes
You can also run a memory profiler on your app:
http://timetobleed.com/memprof-a-ruby-level-memory-profiler/
https://www.ruby-toolbox.com/search?utf8=%E2%9C%93&q=profile
Heroku Error R14 (Memory quota exceeded): How do I solve this?
I had this problem .. to solved using find_in_batches.
If someone still has this error i will put the code here.
As it takes long time to run, i found a progress_bar gem that help the user. will let it here too cause i think its mandatory in almost every case.
bar = ProgressBar.new( total )
Texto.find_in_batches(:batch_size => 100) do |textos|
textos.each{| texto |
...do_stuff...
}
bar.increment! textos.size
end
Progress Bar:
https://github.com/paul/progress_bar/issues
Error R14 (Memory quota exceeded) + Heroku + Passenger
I suggest you to see the code with Name.all.each do |block|
and change it to Name.find_each do |block|
. This way you can save memory by not loading entire model all at once.
Also try running some benchmark tests so that you can find memory leaks that are causing R14 errors.
This link gives you more information https://devcenter.heroku.com/articles/ruby-memory-use#memory-leaks
Heroku Error R14 (Memory quota exceeded) when run Prawn::Document.image
After discuss with my team, I got the reason.
The image dimension is 1920*1080, and it seems cant solve such image with Prawn::Document.image on heroku. A 400*400 works.
But dont know why a 27k png image can eatup 400M heroku memory.
Related Topics
Ruby Method Calls Declared in Class Body
Why 'Self' Method of Module Cannot Become a Singleton Method of Class
Rails If Object.Nil? Then Magic '' in Views
Monkey-Patching VS. S.O.L.I.D. Principles
Difference Between Map and Each
How to Avoid Duplicates in a Has_Many :Through Relationship
Check If Two Arrays Have the Same Contents (In Any Order)
How to Ban/Block Users with Devise for Rails
Is Ruby on Rails (Or at Least the Community) Dying
Ruby - Using Class_Eval to Define Methods
Are There Any Ipython-Like Shells for Ruby or Rails
In Ruby, What Structures Can a 'Rescue' Statement Be Nested In