alexanoid
alexanoid

Reputation: 25780

Tomcat 8 memory leak

I'm developing Java Web application using Spring/Spring Boot/MySQL and deployed it to Tomcat 8.

In Tomcat Web Application Manager I click Reload button and after successful redeploy - Find Leaks button and have a following message:

The following web applications were stopped (reloaded, undeployed), but their
classes from previous runs are still loaded in memory, thus causing a memory
leak (use a profiler to confirm):
/domain-api
/domain-api

My Tomcat log does not contain messages about possible memory leaks..

Looks like right now I have a 2 instances of my application(domain-api) up and running.. How to check it and how to fix it ?

Upvotes: 3

Views: 1304

Answers (1)

eztam
eztam

Reputation: 3829

This has not to mean, that your application has a memory leak. The message in the tomcat manager just means, that there are still some classes from a previously deployed web application loaded that have not yet been garbage collected.

If it is not a memory leak then this warning could be removed by setting your permGenSpace to a lower value. This will force the GC to unload all classes after you redeploy your app.

An other way to ensure you have no memory leak is to redeploy the app a few times and the create a heapdump and analyze it with a profiler like Eclipse Memory Analyzer . There you should look for instances of the type WebappClassLoader that cannot be garbage collected.

Upvotes: 1

Related Questions