Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.3.6
-
None
-
Patch
Description
I discovered this issue while working on https://jira.grails.org/browse/GRAILS-11296
Each time GStringTemplateEngine compiles a template, it makes a new class. However, it makes all those new classes on the main (parent) class loader. Since that class loader has loaded many other classes that won't ever get GC'ed, and a class can only be GC'ed when it's class loader is GC'ed and vice versa, these GStringTemplateEngine created classes can never be GC'ed. With enough invocations, memory is exhausted. These classes show up in memory dumps as "GStringTemplateScript" followed by a number.