1 Reply Latest reply on Feb 21, 2012 2:58 PM by Dan Kane

    Unable to generate heapdump with jmap

    Doug S Newbie

      Hey All,

       

      I wasn't sure where this topic belongs so I figured I'd try here and let it be moved if it needs to. 

       

      I have an environment running JbossAS 4.2.0.GA_CP05_EAP with ATG on top on a virtualized redhat linux OS.  I believe we have memory leak issues in the code and am trying to generate a heapdump manually with the jmap command but having issues.  I'm running the command jmap -heap:format=b <pid> and let it write the heapdump to my current directory.  The command starts up fine and the heapdump starts writing, but it's writing extremely slow.  It only writes about 120KB/second and just stops when the heapdump file gets to around 21MB.  After that the session where I initiated the command just starts spitting out data like below to the stdout.  The exception at the end is what happens when I ctrl-c.

       

       

      Free chunk in CMS heap, size=64

      Free chunk in CMS heap, size=64

      Free chunk in CMS heap, size=64

      Free chunk in CMS heap, size=64

      Free chunk in CMS heap, size=64

      Free chunk in CMS heap, size=64

      Free chunk in CMS heap, size=64

      Free chunk in CMS heap, size=64

      Free chunk in CMS heap, size=64

      Free chunk in CMS heap, size=544550792

      Exception in thread "main" java.lang.RuntimeException: VM.initialize() was not yet called

              at sun.jvm.hotspot.runtime.VM.getVM(VM.java:313)

              at sun.jvm.hotspot.oops.Oop.alignObjectOffset(Oop.java:104)

              at sun.jvm.hotspot.oops.InstanceKlass.getObjectSize(InstanceKlass.java:656)

              at sun.jvm.hotspot.memory.CompactibleFreeListSpace.getLiveRegions(CompactibleFreeListSpace.java:123)

              at sun.jvm.hotspot.oops.ObjectHeap$LiveRegionsCollector.doSpace(ObjectHeap.java:514)

              at sun.jvm.hotspot.memory.ConcurrentMarkSweepGeneration.spaceIterate(ConcurrentMarkSweepGeneration.java:49)

              at sun.jvm.hotspot.oops.ObjectHeap.addPermGenLiveRegions(ObjectHeap.java:479)

              at sun.jvm.hotspot.oops.ObjectHeap.collectLiveRegions(ObjectHeap.java:559)

              at sun.jvm.hotspot.oops.ObjectHeap.iterate(ObjectHeap.java:226)

              at sun.jvm.hotspot.utilities.AbstractHeapGraphWriter.write(AbstractHeapGraphWriter.java:34)

              at sun.jvm.hotspot.utilities.HeapHprofBinWriter.write(HeapHprofBinWriter.java:399)

              at sun.jvm.hotspot.tools.JMap.writeHeapHprofBin(JMap.java:133)

              at sun.jvm.hotspot.tools.JMap.writeHeapHprofBin(JMap.java:143)

              at sun.jvm.hotspot.tools.JMap.run(JMap.java:71)

              at sun.jvm.hotspot.tools.Tool.start(Tool.java:204)

              at sun.jvm.hotspot.tools.JMap.main(JMap.java:126)

       

       

      I'm not sure where to go from this point.  I need to generate them on the fly because I'm not running into any OOM scenarios.  Below is my java version info as well.  Can anyone point me in the right direction?  Thanks

       

       

      $ /tools/jdk1.5.0_16_64bit/bin/java -version

      java version "1.5.0_16"

      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b02)

      Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_16-b02, mixed mode)