4

I am running JDK 1.8_291 and JDK Mission Control 8.0.0.

I am trying to activate Live Objects tab in Flight Recording, Live Objects tab is always empty

I have followed older threads discussing the same problem like:

  1. Java Flight Recorder - no Live Objects
  2. How to enable Object Types + Allocation Stack Traces + Path to GC Root in Java Mission Control

These are the commands I am using :

-ea -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:StartFlightRecording=duration=0s,filename=myrecording.jfr,settings=/Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home/jre/lib/jfr/profile4.jfc,path-to-gc-roots=true,dumponexit=true

The problem is that I get an error saying "path-to-gc-roots" is an unknown argument.

java.lang.IllegalArgumentException: Unknown argument 'path-to-gc-roots' in diagnostic command.Error occurred during initialization of VM

And this is the settings file I am using: https://pastebin.com/rH5vuVvS

I have noticed that the official documentation of JFR currently does not contain the argument "path-to-gc-roots". But it was present in an older documentation like this one: https://docs.oracle.com/javacomponents/jmc-5-5/jfr-command-reference/JFRCR.pdf

I am asking if there is an alternative way to activate Live Objects tab as this way might be deprecated.

Tarek Hany
  • 41
  • 2

1 Answers1

4

The Old Object Sample event, which can be configured by path-to-gc-roots is not available in Oracle JDK 8. It was introduced in Oracle JDK 10, which is what the referenced pdf-file covers.

There exists two Object Count events, since Oracle JDK 7u40, that traverses the whole heap and count the number of objects per class, no sampling. It's not visualized in the JMC 8 'Live Object' page, but available in JMC 5.5, in the tab called 'Object Statistics'

enter image description here

Kire Haglin
  • 6,569
  • 22
  • 27
  • Thank you for your reply. I think the "Object Statistics" tab in JMC 5.5 is the same as "Memory" tab in JMC 8, they basically count the number of objects created for each class and the amount of memory taken, is that correct? – Tarek Hany Aug 19 '21 at 11:05
  • I need to monitor timing information about objects starting from their creation till GC collects them. Is that possible in any way? I thought this is possible through the Live Objects tab. But as far as I understand from you, it is not possible to get this information using JDK 8. – Tarek Hany Aug 19 '21 at 11:15
  • The Old Object Sample event doesn't count objects. It's mainly for finding memory leaks by also recording the timestamp and stack trace of the allocation. That said, the sampling should give a statistically correct picture of the live objects on the heap. It's not possible to get the lifespan of objects using Oracle JDK 8. – Kire Haglin Aug 19 '21 at 15:47