users@glassfish.java.net

Re: Jsr199JavaCompiler possible memory leak?

From: <glassfish_at_javadesktop.org>
Date: Thu, 15 Jan 2009 16:29:10 PST

There are two reasons to keep the bytecodes around:

1. for loading the compiled JSP page. Once a class is loaded, we can certainly remove them from the memory.
2. for javac compilations. When a JSP page is compiled, if the page refers to a class produced by a previous compilation, we need to tell javac where the bytecodes for that class is. packageMap keeps track of such info. This gets tricky when tag files are involved, because tag files are compiled on the fly, so we may suspend a compilation to compile the referenced tags file first, so it is not easy to tell when some bytecodes can be released.

It is true that once a classFiles is created, it only got unloaded when the application is unloaded. That should be OK for development. For deploying real application, it is always a good idea to precompile JSP pages.
[Message sent by forum member 'kchung' (kchung)]

http://forums.java.net/jive/thread.jspa?messageID=326364