Last month, my team started load-testing a project which using Grails framework. Unexpected result happened, while it's load-tested for a couple of hour. "Out of memory" exception occurred in the log file. Firstly, my team suspected that jvm has low memory because what I'd search from internet said that Grails need minimum memory at 512mb when my server has 2 Grails-war in 512mb. But when memory’s incresed to 768mb, it’s still throw “Out of memory” exception. So we suspected which instance consume all of our memory.
We use VisualVM to investigate our CPU usage and memory usage. In the above picture, you’ll see that memory usage increase rapidly from 500mb to 768mb, maximum allowed memory, and never decrese although GC process.
From Heap histogram view, we see that org.codehaus.groovy.runtime.metaclass.MetaMethodIndex$Entry used all of our memory. We found that many of these instances reference to ConfigSluper$_parse_closure5.
When we search “grails configsluper memory leak” in google, we found some people have same problem with us. The blog that we found is below.
http://stackoverflow.com/questions/14200415/grails-configslurper-memory-leak
So we fix how we create ConfigSlurper and this is the result.
Viola!