Bug 63236 - Reduce duplicate Strings
Summary: Reduce duplicate Strings
Alias: None
Product: Tomcat 9
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 9.0.16
Hardware: PC Mac OS X 10.1
: P2 normal (vote)
Target Milestone: -----
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2019-03-06 01:02 UTC by Phillip Webb
Modified: 2019-03-07 20:22 UTC (History)
1 user (show)


Note You need to log in before you can comment on or make changes to this bug.
Description Phillip Webb 2019-03-06 01:02:31 UTC
Some profiling of Tomcat reveals that it currently creates quite a few duplicate String values. Most of these appear to be from objects created when parsing the `mbeans-descriptors.xml` files. For example, `java.lang.String` is a very common `type` attribute.

By using a Map technique as describe in https://shipilev.net/jvm/anatomy-quarks/10-string-intern/ we could reduce memory consumption.
Comment 1 Phillip Webb 2019-03-06 01:06:56 UTC
Pull request available at https://github.com/apache/tomcat/pull/143
Comment 2 Mark Thomas 2019-03-07 20:22:47 UTC
Fixed in:
- trunk for 9.0.17 onwards
- 8.5.x for 8.5.39 onwards
- 7.0.x for 7.0.94 onwards