RanPaul RanPaul - 6 months ago 29
Java Question

In a visualvm heap dump, what is the number after "Local Variable" for threads?

I am analyzing the threads in the heap dump using the

VisualVM
and am wondering whats the count after the
Local Variable: byte[]
in the below thread means? does it mean the size of the variable? or the total number of instances of the variable? or anything else?

"Multicast Heartbeat Receiver Thread" daemon prio=5 tid=38 RUNNABLE
at java.util.zip.Inflater.inflateBytes(Native Method)
at java.util.zip.Inflater.inflate(<unknown string>)
Local Variable: java.util.zip.ZStreamRef#366
Local Variable: java.util.zip.Inflater#366
at java.util.zip.InflaterInputStream.read(<unknown string>)
at java.util.zip.GZIPInputStream.read(<unknown string>)
at net.sf.ehcache.distribution.PayloadUtil.ungzip(PayloadUtil.java:194)
Local Variable: java.util.zip.GZIPInputStream#1
Local Variable: byte[]#537427
Local Variable: byte[]#537474
Local Variable: java.io.ByteArrayOutputStream#317
at net.sf.ehcache.distribution.MulticastKeepaliveHeartbeatReceiver$MulticastReceiverThread.processPayload(MulticastKeepaliveHeartbeatReceiver.java:142)
Local Variable: org.glowroot.agent.model.TraceEntryImpl#12145
Local Variable: org.glowroot.agent.model.OptionalThreadContextImpl#7
at net.sf.ehcache.distribution.MulticastKeepaliveHeartbeatReceiver$MulticastReceiverThread.run(MulticastKeepaliveHeartbeatReceiver.java:126)
Local Variable: byte[]#4513

Answer

The number after the # is a sequence number. E.g. Local Variable: byte[]#537427 means that this is your 537427:th instance of byte[].

It becomes clear if you click the instances tab in visual vm. In the following picture I see a list of all my byte arrays in my test program, enumerated from #1 and onwards, where N items denotes the size of the array.

enter image description here