Created attachment 32647 [details] simple patch I analyzed several heap dumps to find out why for small applications Tomcat uses more memory than Jetty. Some of this seems to come from the fact that for ever web application a merged web.xml is stored in memory. A comment in ContextConfig suggests that this was once necessary for Jasper but it looks as if the relevant TODO has been fixed by now. On a default Tomcat with the default applications this saves about 1MB.
The constant doesn't look like it is used, but this may not be such a good idea. I'll leave the BZ open for further review.
In Tomcat 7 the MERGED_WEB_XML ("org.apache.tomcat.util.scan.MergedWebXml") attribute is used to pass web application configuration to Jasper. In Tomcat 8 it is unused, but it is used by Tomcat test cases (TestWebXml). Your "simple patch" will break the tests. In theory, there can be 3rd party code that uses this feature. http://markmail.org/message/hqnuyvikofmfcbl2 "Offline generation of effective web.xml" thread on 2012-09, one of first discussions of this issue.
Which part of TestWebXml does it break? The test compiles and 19/19 tests are green.
I think this can be useful for debugging and monitoring (management interfaces like this kind of stuff), but since this is a String it is probably not that useful for apps. testWebXml mentions it but doesn't actually test it.
The flag to log the merged web.xml is still in there.
Created attachment 32661 [details] 2nd try at a patch Updated patch: - keeps the constant but marks it as deprecated - keeps the switch to log the merged web.xml for debugging
Thanks for the patch. I'd forgotten about this issue until after I had already fixed the code buy my approach was broadly similar. The constant for the attribute name has been deprecated in 8.0.x and the constant and the use of it has been removed in 9.0.x.