You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by "Daniel Dekany (JIRA)" <ji...@apache.org> on 2016/09/20 06:52:21 UTC

[jira] [Commented] (FREEMARKER-32) Memory Leak

    [ https://issues.apache.org/jira/browse/FREEMARKER-32?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15505796#comment-15505796 ] 

Daniel Dekany commented on FREEMARKER-32:
-----------------------------------------

Any updates on this? Is my above guess (number of generated classes grows without limit) the case there?

> 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)