Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Incomplete
-
2.3.23
-
None
-
Linux, JDK 1.8
Description
When processing over 2000 calls to hydrate a freemarker template with supplied pojos, the app server hosting the web app goes out of memory. When I looked at the head dump, the freemarker.template.DefaultObjectWrapper's classInstrospector instance of freemarker.ext.beans.ClassIntrospector seems to holding on to instance of pojos apparently in a hashmap.
freemarker.ext.beans.ClassIntrospector --> java.util.concurrent.ConcurrentHashMap -->
.\java.util.concurrent.ConcurrentHashMap$Segment[16]
I am initializing the set up in this way once when the application boots up
cfg = new Configuration(new Version(2, 3, 23));
cfg.setDefaultEncoding("UTF-8");
cfg.setLocale(Locale.US);
cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
cfg.setClassForTemplateLoading(FreemarkerTransformer.class,
"/templates");
So during a burst of calls, I run out of 512M of PermGenSize on my JVM.
Is there a workaround to solve this problem?
Thank you
Ashwin