https://bz.apache.org/bugzilla/show_bug.cgi?id=69398

            Bug ID: 69398
           Summary: Excess object allocation in PageContextImpl
           Product: Tomcat 9
           Version: 9.0.x
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jasper
          Assignee: dev@tomcat.apache.org
          Reporter: jeng...@amazon.com
  Target Milestone: -----

The constructor org.apache.jasper.runtime.PageContextImpl includes this line:

this.outs = new BodyContentImpl[0];

Heap analysis of our large, JSP-heavy app shows large numbers of
BodyContentImpl[], with sizes ranked in order of frequency:

[0]
[1]
[2]
[3]
[4]

There are two ways to address this:

1. Define "private static final EMPTY_ARRAY = new BodyContentImpl[0]" and
assign this value in the constructor
2. Change the allocation to BodyContentImpl[1] or [2], thus eliminating [0] and
copies

My testing shows that change #1 eliminates the [0] arrays and saves < 5% of
clock time; this is definitely about heap pollution rather than direct runtime.

Option #2 is harder to predict since it potentially adds overhead when the [0]
is sufficient.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to