Heroku Memory Quota Exceeded Heroku Memory Quota Exceeded nginx nginx

Heroku Memory Quota Exceeded


It's hard to tell what the reason is without seeing your code, but here are a few things to keep in mind:

  • Your application is using more than 512MB memory regardless of how many users you have -- this just means your code itself (and any dependencies) are taking up quite a bit of space.
  • If you're using rails, make sure you're only running on thread if possible -- each rails instance takes up quite a bit of memory, so if you are running many instances on a single dyno this is the likely culprit.
  • If you're doing any sort of large memory intensive stuff (processing PDFs, uploading files larger than a few MB, etc.) -- you might want to consider refactoring your approach -- doing this stuff on a dyno is NOT optimal.
  • If you're leaking memory, your new relic graphs will show a rise in application memory over time. Look out for this -- you might have a leak somewhere!


I used the following build pack which is Nginx+Unicorn. By using Ngix as the front web server, unicorn can do it's application server jobs smoothly.

https://elements.heroku.com/buildpacks/kazw/nginx-buildpack