1

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.

trincot
  • 317,000
  • 35
  • 244
  • 286
Rohit
  • 523
  • 2
  • 6
  • 25

1 Answers1

2

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.

Tomas Hurka
  • 6,723
  • 29
  • 38
  • Thanks Tomas, that helped understand what I need to do. I believe I can run the jmap command you mentioned as part of the shell script with timers around it to measure how long it might take. Thanks for your help. – Rohit Apr 08 '13 at 12:28
  • 1
    Ok, note that you can also leave out 'live' option. In such case no GC is invoked prior the heap dump. – Tomas Hurka Apr 08 '13 at 14:23