Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tomcat - their classes from previous runs are still loaded in memory

when stop my project , tomcat say :

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) .

Where we find that Which classes are left in memory ?

please help me .

like image 657
Ali Farozi Avatar asked May 25 '12 14:05

Ali Farozi


1 Answers

You can run jmap -histo which will show you loaded classes.

For example:

jmap -histo[:live] <pid>
    to connect to running process and print histogram of java object heap
    if the "live" suboption is specified, only count live objects

Example: jmap -dump:live,format=b,file=heap.bin <pid>

Another way is to enable classloading debug information and do some scripting to detect what is left loaded.

like image 188
mindas Avatar answered Sep 28 '22 00:09

mindas