Nikita, > I work on application which allows user to deploy/undeploy large number of > the JSP pages to AppServer (JBoss 4.03sp1 + Tomcat 5.5). Standard Tomcat > class loader caches classes for all deployed JSP internally and never clean > its cache. This brings JVM to PermGen overflow error after several days of > system work.
Ouch. Are you saying that the sheer number of classes in your system is overflowing your memory? That doesn't seem likely. After tomcat compiles your JSP, it loads the resulting class and executes it like a servlet. If you have an option enabled, it will detect updated JSPs, re-compile them, and reload them. It is certainly possible that when this happens, Tomcat discards the entire ClassLoader and starts fresh. In that case, if you have 10,000 JSPs, then each time you reload, you'll get 10,000 more classes loaded into memory. If this happens enough times, you'll run out of memory since Java does not clean up old, unused classes in memory. Is this the behavior you are describing? If so, then you can't fix the problem by writing your own JSP compiler and/or ClassLoader. Your best bet is not to modify your JSPs and have them re-loaded. Is this in a development setting or production? I would say that having JSP reloading turned on in production is a mistake. -chris
signature.asc
Description: OpenPGP digital signature