[
https://issues.apache.org/jira/browse/FREEMARKER-32?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15438528#comment-15438528
]
Daniel Dekany commented on FREEMARKER-32:
-----------------------------------------
The {{ClassIntrospector}} meant to cache information about classes that were
once accessed from templates, so unless the number of classes keeps growing
without limit in your application, the introspection data shouldn't grow
without limit. Are you generating classes on the fly maybe, each with a unique
name?
> Memory Leak
> -----------
>
> Key: FREEMARKER-32
> URL: https://issues.apache.org/jira/browse/FREEMARKER-32
> Project: Apache Freemarker
> Issue Type: Bug
> Components: engine
> Affects Versions: 2.3.23
> Environment: Linux, JDK 1.8
> Reporter: ashwini kuntamukkala
> Labels: freemarker, leak, memory
> Attachments: freemarker-memory-leak.png
>
>
> 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
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)