Grails R14 Error (Memory quota exceeded) on Heroku

Explains how to resolve the Grails R14 Error when it is encountered on Heroku..

Brandon Fish

I have frequently encountered the following Error R14 (Memory quota exceeded) in the logs while running Grails apps on Heroku on the 1x Dyno which only allows 512mb of RAM:

2014-05-08T04:46:48.294887+00:00 heroku[web.1]: Process running mem=557M(108.9%)
2014-05-08T04:46:48.295268+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)

To debug the issue and to be sure I was not having an application specific error, I created a new Grails application and followed the “Getting Started with Grails on Heroku” tutorial, but I still was getting the R14 error with a new application. To debug how much memory was being used, I used the Application Info plugin and ran the new application on Heroku. The source for this application can be found on Github.

I tried to run the same build and server process as Heroku locally but found about a 100mb difference in memory usage. The only difference I had locally was using JDK7. So, I configured the project to use JDK7 on Heroku by add adding a “system.properties” file to the project with the JDK configuration as described in the Heroku Grails tutorial:

#system.properties
java.runtime.version=1.7

After starting up with the new JDK, I no longer say the Error R14 in the logs.

Using JDK7 on Heroku, the Grails application used much less memory on startup (454 vs 582 mb) and under load (496 vs 643 mb) using Apache Bench.

Share this Post

Related Blog Posts

JVM

Reuse your Gradle logic across the enterprise

April 24th, 2014

Gradle build code will sometimes need to be reused across the enterprise. Here are a few ways to do so.

David Norton
JVM

Tracking Hibernate statistics across Grails actions

April 22nd, 2014

Using controller filters to configure tracking and logging of Hibernate statistics in HTTP requests.

Igor Shults
JVM

Spock Mock Cheatsheet

April 8th, 2014

Summary of unit test mocking capabilites and syntax of Spock test framework

Object Partners

About the author

Brandon Fish

Sr. Consultant

Brandon has over 6 years of software development experience with Spring and related JEE technologies including the last year plus working on a large scale enterprise Grails application. He has successfully delivered client projects using a variety of technologies and filling many project roles including lead software developer, requirements gatherer, domain expert, systems administrator, offshore team manager, and Scrum master. He is passionate and up to date with best software development practices in order to deliver projects efficiently, meeting client expectations and with a high quality.