I have a JSP file with about 100 custom tags and when it compiles in the JSP container (tested with Tomcat and Jetty) the JVM takes up to 100Mb of RAM (peak) and crashes if no more memory is available.

Alessandro A. Garbagnati

If you are using a standard server like Tomcat or WebLogic, you can make use of the JSP precompiler jspc and precompile the jsp file to a Java source file. You can then manually compile this by hand and always have under control the memory used by the system. You could also then run a code profiler to give you a better indication of where the major problem is.