You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by "Dániel Dékány (Jira)" <ji...@apache.org> on 2024/06/02 12:58:00 UTC
[jira] [Closed] (FREEMARKER-214) New LookAheadSuccess instance created for each instance of FMParser
[ https://issues.apache.org/jira/browse/FREEMARKER-214?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dániel Dékány closed FREEMARKER-214.
------------------------------------
> New LookAheadSuccess instance created for each instance of FMParser
> -------------------------------------------------------------------
>
> Key: FREEMARKER-214
> URL: https://issues.apache.org/jira/browse/FREEMARKER-214
> Project: Apache Freemarker
> Issue Type: Bug
> Reporter: Donnchadh Ó Donnabháin
> Priority: Major
> Fix For: 2.3.33
>
> Attachments: javacc-7.1.2-diff.txt
>
> Time Spent: 50m
> Remaining Estimate: 0h
>
> Each instance of FMParser creates a new instance of LookAheadSuccess.
> In our case, where we tend to work with a lot of FreeMarker templates (in some cases generating freemarker template as an intermediate representation of a more abstract form), this has had a couple of impacts:
> 1. LookAheadSuccess extends java.lang.Error which adds noise to our Java Flight Recorder recordings, similar to the situation described in [http://hirt.se/blog/?p=1288]
> 2. Each instance fills in a stack trace, causing unnecessary object allocation, given that
>
> These issues (non-static LookAheadSuccess instance, extending java.lang.Error, populating a stack trace) have been addressed in JavaCC 7 in the following PR
> [https://github.com/javacc/javacc/pull/99/files]
>
> If it seems reasonable, I would be willing to create a PR to update FreeMarker 2.3 to Java CC 7.x. The unit tests do seem to pass with Java CC 7.
>
> If upgrading JavaCC is deemed undesirable, the approach used to make the class static in [https://github.com/apache/freemarker/blob/2.3-gae/build.xml#L157] could probably also be used to make the instance final.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)