2

I'm debugging a memory leak with JProfiler 7.2.3 in a process running JRE 1.6.0_51 (amd64):

$ java -version
java version "1.6.0_51"
Java(TM) SE Runtime Environment (build 1.6.0_51-b11-457-11M4509)
Java HotSpot(TM) 64-Bit Server VM (build 20.51-b01-457, mixed mode)

JProfiler's Allocation Call Tree shows java.lang.Long objects allocated in Object.wait and sun.misc.Unsafe.park. I drilled down into the JVM source code and did not find any memory allocation there. Anyone has any insight into this?

Here you can see JProfiler reporting allocation of objects by Object.wait:

enter image description here

And by sun.misc.Unsafe.park:

(stackoverflow won't let me embed images)

Shervin
  • 1,936
  • 17
  • 27
  • Do you use sampling or instrumentation? – Ingo Kegel Jul 11 '13 at 19:45
  • Sampling mode with default settings. –  Jul 11 '13 at 19:48
  • I guess it's a `long` that gets auto-boxed into a `Long` and is most likely the current time since that's useful for waiting. – zapl Jul 11 '13 at 20:02
  • I don't see any allocation of Longs in the cpp source code. Note that JProfiler reports the allocation inside a native method: `public final native void wait(long timeout) throws InterruptedException;` Any Long's I would allocate before calling `wait` would show up in a parent caller node. –  Jul 11 '13 at 20:19
  • There are no allocations in wait, this is due to the inaccuracy of sampling, I've just added this as an answer. – Ingo Kegel Jul 11 '13 at 20:44

1 Answers1

2

When you use sampling, call stacks are only approximate.

To get exact call stacks, use instrumentation.

Ingo Kegel
  • 46,523
  • 10
  • 71
  • 102