Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How long to run compute retained sizes in visual VM for a 1GB heap?

I have a 1 GB heap dump from a java process that ran out of heap space. I have uploaded the heap into jvisualm that comes with a java6 distribution. I started the "compute retained sizes" process around 16 hours ago and it is still running. How long should it take to run the compute retained sizes for the top 20 objects on a 1GB heap? Should I expect it to ever finish?

like image 628
Joe Avatar asked Nov 29 '11 18:11

Joe


People also ask

What is retained in Visual VM?

After getting the heap dump, we can import it into tools like Visual VM: As shown above, the retained size of the only Course instance is 24 bytes. As mentioned earlier, the retained size can be anywhere between shallow (16 bytes) and deep sizes (88 bytes).

What is retained size in heap dump?

Retained heap is the amount of memory that will be freed when the particular object is garbage collected. Thus, retained heap size of B is 30 bytes.

What is shallow size and retained size?

shallow size: the size of the object itself. retained size: the size of the object itself, plus the size of other objects that are kept alive by this object.


2 Answers

It seems to take forever on my machine as well, but I noticed from the taskmanager that nothing seemed to happen anymore (low CPU uage, Disk I/O). The reason was that although the progress indicator keeps showing an animation the action was silently aborted according to the log file.

To open the log I used these steps:

  • Click Help
  • Click About
  • Click Logfile

This showed me at the bottom of the log:

SEVERE [org.openide.util.RequestProcessor]
java.lang.OutOfMemoryError: GC overhead limit exceeded
    at java.util.HashMap.newNode(HashMap.java:1734)
    at java.util.HashMap.putVal(HashMap.java:630)
    at java.util.HashMap.put(HashMap.java:611)
    at java.util.HashSet.add(HashSet.java:219)
    at org.netbeans.lib.profiler.heap.DominatorTree.intersect(DominatorTree.java:279)
    at org.netbeans.lib.profiler.heap.DominatorTree.computeOneLevel(DominatorTree.java:114)
    at org.netbeans.lib.profiler.heap.DominatorTree.computeDominators(DominatorTree.java:64)
    at org.netbeans.lib.profiler.heap.HprofHeap.computeRetainedSize(HprofHeap.java:537)
    at org.netbeans.lib.profiler.heap.HprofHeap.computeRetainedSizeByClass(HprofHeap.java:594)
    at org.netbeans.lib.profiler.heap.ClassDump.getRetainedSizeByClass(ClassDump.java:102)
    at org.netbeans.modules.profiler.heapwalk.HeapFragmentWalker.computeRetainedSizes(HeapFragmentWalker.java:100)
    at org.netbeans.modules.profiler.heapwalk.ClassPresenterPanel$1$1.run(ClassPresenterPanel.java:187)
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1393)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2003)

By default my 64 bit Java VM Heapsize will be limited to 25% of my computer memory (or even a much lower VisualVM builtin limit). To solve this issue for my next attempt I wil try again starting VisualVM like this:

jvisualvm.exe -J-Xmx16g

After this the log shows at startup:

Heap memory usage: initial 24,0MB maximum 14563,6MB
like image 169
JohannesB Avatar answered Oct 20 '22 00:10

JohannesB


I had a 600MB heap that just took 900 CPU-minutes of time to compute retained sizes. That's 15 hours. I would assume it's very related to what's on the heap, so I won't extrapolate to your heap (also you pointed out it didn't finish ;), but it's another data point.

like image 41
Rob I Avatar answered Oct 20 '22 00:10

Rob I