How do I measure current memory use and max available memory on a dyno in a Private Space?

Issue

I would like to let the app code to adjust memory usage to avoid R15 - Memory quota vastly exceeded errors but the free command shows inconsistent results. How can I obtain current memory use and max available memory on a dyno in a Private Space?

Resolution

Please refer to the files /sys/fs/cgroup/memory/memory.usage_in_bytes and /sys/fs/cgroup/memory/memory.limit_in_bytes.

Dynos for Heroku apps run in containers while some of Linux tools, like the free command, refers to metrics from the underlying instance. Some of our engineers are aware of the file under the /sys/fs/cgroup/memory/ show expected values around memory available for the dyno.

Ask on Stack Overflow

Engage with a community of passionate experts to get the answers you need

Ask on Stack Overflow

Heroku Support

Create a support ticket and our support experts will get back to you

Contact Heroku Support