https://bz.apache.org/bugzilla/show_bug.cgi?id=57808
Bug ID: 57808 Summary: Don't preload all charsets Product: Tomcat 8 Version: trunk Hardware: PC OS: Mac OS X 10.1 Status: NEW Severity: normal Priority: P2 Component: Util Assignee: dev@tomcat.apache.org Reporter: kus...@gmx.net Created attachment 32646 --> https://bz.apache.org/bugzilla/attachment.cgi?id=32646&action=edit simple patch I analyzed several heap dumps and and for small applications it seems that Tomcat uses about twice as much memory as Jetty (roughly 20MB vs 10MB). Most of this seems to come from Charset instances. While the number of Charsets is low some of them (mostly EBCDIC and GB18030) have quite large coding tables. The attached patch only preloads UTF-8 and ISO-8859-1, this saves about 5MB. That doesn't sound drastic but makes Tomcat to go from about 17.5MB to 12.5MB. Due to the discussion in 51400 I decided not to cache look up failures. I decided to use a ConcurrentHashMap so that readers never block. In theory a fully synchronized map could also be used as look up times should be low and therefore the lock should be uncontended most of the time. See the attached heap dumps for applications before and after the patch. -- 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