On 11/10/2020 02:39, Prabhu Gurunathan wrote:
> Hi All,
> 
> We have an setup where we are using OpenJDK 1.7 and Tomcat 7.0.100 ,
> in CentOs 7 Env . and we have many application deployed in
> Tomcat/webapps and the common lib's needed for those apps are kept in
> Tomcat/lib directory like log4j , commons-fileupload  ,xerces , Xalan
> .. etc
> 
> The problem here is When we try to undeploy and deploy same
> applications multiple time we are  getting into
> java.lang.OutOfMemoryError: PermGen space very quickly . Want to know
> is it very generic problem on this deployment model or is this can be
> fixed anyway ?

The memory leak could be in any of:
- the application code
- a library the application depends on
- the JVM
- Tomcat

In all cases, it should be possible to fix it. There might even be a
short-term workaround available.

First of all, make sure that the JreMemoryLeakPreventionListener is
enabled in your configuration.

Secondly, make sure that you don't get any warnings about possible
memory leaks in the logs when you reload an application. If you do, fix
the leaks identified.

If you still see issues, the short version is:
- user a profiler
- reload each app in turn until you see more strong references to
  org.apache.catalina.loader.[Parallel]WebappClassLoader instances in
  memory than you have web applications
- find the one where started = false
- trace its GC roots
- that will tell you where the memory leak is
- how it was created might be harder to track down

The long version is in a presentation linked from the Tomcat web site:
https://home.apache.org/~markt/presentations/2010-08-05-Memory-Leaks-JavaOne-60mins.pdf

If you have any questions, you can ask here.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to