philwebb commented on issue #143: Apply deduplication to certain loaded and created Strings URL: https://github.com/apache/tomcat/pull/143#issuecomment-470145284 Sure. I discovered these by using the "Inspections" feature from [YourKit](https://www.yourkit.com/) on an [embedded Tomcat application](https://github.com/spring-projects/spring-boot/tree/87d696d6971c8bbd28be4fa885f9cf5719309c99/spring-boot-samples/spring-boot-sample-tomcat). Without the change YourKit reports 2192 duplicate Strings, with the change it's 1126 (so a saving of 1066). It's hard to get the exact memory saving but scanning the UI for the top hitters we have: | String | Duplicates | Waste | --- | --- | -- | "java.lang.String" | 2192 | 149112 | "ACTION" | 542 | 38952 | "boolean" | 191 | 10640 | "void" | 204 | 9744 | "Introspected parameter param0" | 80 | 8216 | "int" | 155 | 7392 | "[Ljava.lang.String;" | 42 | 3280 | So it looks like at least 227336 bytes can be saved. One other thing to consider is that I think these Strings are retained for the life of the application. They can't be GC'd because references remain until shutdown.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org