Why am I getting R14 Errors in Java

Issue

My Java application's logs have R14 errors in them

Resolution

This error indicates that your dyno does not have enough RAM to contain the JVM's memory. As a result the Linux operating system has moved some pages to disk (a process called swapping). When the operating system does this, it does not differentiate between heap and non-heap memory in the JVM. If heap memory is swapped, it can result is significant performance degradation.

To change Java's memory usage, use the arguments -Xms -Xmx. Use M or G after the numbers for indicating Megabytes and Gigabytes of bytes respectively. -Xms indicates the minimum and -Xmx the maximum.