grails/grails-core — pull request #481 by candrews (2014-04-10 16:25:17+00:00)
Title: GRAILS-11296: Weak metaclass reference for GSPs

If Groovy holds a strong metaclass references for GSP classes, then the GSP class and the metaclass are never eligible for GC. So when Grails loads a new GSP (because reloading is enabled and the .gsp file changed), both the old and the new GSP class and its metaclass stay in memory. This leak will eventually cause an OutOfMemoryError if enough GSPs are reloaded. Changing the metaclass references from strong to weak allows GC'ing to be done as expected, eliminating the leak.