I have a significant memory leak in my application. I have run jmap and it says that there are currently the following objects that should not be there (and are the major source of leak):
java.lang.management.MemoryUsage - 3938500 instances, 189048000 bytes
[Ljava.lang.management.MemoryUsage - 787700 instances, 31508000 bytes
com.sun.management.GCInfo - 293850 instances, 22055600 bytes
sun.management.GCInfoCompositeData - 393850 instances, 12603200 bytes
I do not directly use these objects. They are however used by Garbage Collector. I use:
Java version: 1.7.0-b147
VM version: Java Hotspot(TM) 64-bit Server VM (build 21.0-b17, mixed mode)
The application is run in Jetty version 7.3.1
I use currently Concurrent low pause garbage collector. However I had the same problem even when running the Throughput collector.
Do you have any idea why do these objects stay in the memory? What would you suggest to do?
UPDATE: The memory leak still occurs with Java 1.7 update 1 (1.7.0_01-b08, Java Hotspot(TM) 64-bit Server VM (build 21.1-b02, mixed mode) )
UPDATE 2: The memory leak is caused by JConsole. There are no instances of classes mentioned above before JConosole is started. Once I connect to the application with JConsole, the objects start to appear in the memory and they remain there forever. After I shutdown JConsole, objects are still in memory and the amount of them is growing until the application is shutdown.