heap-memoryvisualvmjconsoleheap-dumpjvisualvm

Could someone please tell me how to measure the time taken for heap dumps using either JConsole or VisualVM?


I am trying to analyze the performance impact of trying to take a heap dump for my application that uses close to 3 GB of heap memory. This is to decide and understand if I should enable the possibility of taking heap dumps as a proactive rather than last ditch reactive measure in monitoring memory leaks. Has someone looked into anything like this before. Is so, could you please help me out. Thanks in advance.


Solution

  • JVM is stopped during heap dumping, so depending on I/O throughput and CPU speed of your hardware this can take from several seconds to tens of seconds. If you want to get just live objects, you have add also time for full GC. You can try running jmap -dump:live,format=b,file=heap.bin <pid> from the commandline to see how long does it take in your case.