Bug 63236

Summary: Reduce duplicate Strings
Product: Tomcat 9 Reporter: Phillip Webb <pwebb>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal CC: awilkinson
Priority: P2    
Version: 9.0.16   
Target Milestone: -----   
Hardware: PC   
OS: Mac OS X 10.1   

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