How to Troubleshoot Memory Bloat at Boot for Rails App

Rails 6 Memory Bloat on Boot

Set compile: false for production in webpacker.yml.

compile: true means: run webpack compilation during the request cycle, something you most likely do not want to do in production since you would instead precompile your assets.

Ways to avoid memory bloat in rails when instantiating a large number of objects?

You should try pluck instead of select, that won't give you objects, just the fields in an array. That should help your memory situation. Check out the docs for more info.

Prawn PDF causing memory bloat in heroku rails app

In case anyone is looking at this in the future - Ruby GC looked to be messing up. Simply dereferencing the pdf (pdf = nil) ensured it was garbage collected.



Related Topics



Leave a reply



Submit