JDK-6890137 : G1: revamp reachable object dump
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: hs17
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2009-10-09
  • Updated: 2013-09-18
  • Resolved: 2011-03-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7 Other
6u18Fixed 7Fixed hs16Fixed
Related Reports
Relates :  
Relates :  
In G1 we have a facility to dump (to standard output or to a file) the objects that are considered reachable (either above TAMS, or marked explicitly). Currently, this is used to optionally dump the live objects when heap verification fails and it was very helpful when debugging the marking bug in CR 6847956. 

This CR revamps this facility in a few ways:

- The current version only uses the "previous" marking information to determine whether an object is live or not. This was acceptable before, as we only did heap verification based on the "previous" marking information. However, CR 6850846 extended heap verification to also used the "next" marking information when necessary (in particular: at the end of remark). So, it is helpful to extend the reachable object dump to be able to use either the "previous" or "next" marking information as necessary. The method is renamed to the more reasonable print_reachable().

- Change print_reachable() to only dump to files and never on tty / gclog_or_tty. The dumps tend to be quite large, even for small-ish heaps, so it's counter productive to do them on tty. There might be several places where we call print_reachble() during a marking cycle (we currently have two, see below). The output files would have the same prefix and a suffix that depends on the point when they were taken (see below).

- There is currently an ad-hoc facility that dumps the reachble objects at the initial mark pause. This is very helpful in order to compare what was reachable at the beginning of the marking cycle with what is reachable at the end of the marking cycle (typically: when verification failed). However, it's best to remove the ad-hoc code in favor of re-using print_reachable().

- Three developer arguments drive print_reachable()
   * G1PrintReachableBaseFile : The base file name for the heap dump file. A suffix will be appended to that depending from where print_reachable() was called.
   * G1PrintReachableAtInitialMark : It dumps the reachable objects at initial mark. The suffix for these files is ".before".
   * G1VerifyDuringGCPrintReachable : It dumps the reachable objects when heap verification fails. The suffix for these files is ".failed-verification'.

- Exclude the reachable object dump code from product builds, as the arguments that enable it are developer arguments.

EVALUATION http://hg.openjdk.java.net/hsx/hsx16/master/rev/2572dd3d6d7c

EVALUATION http://hg.openjdk.java.net/hsx/hsx16/baseline/rev/2572dd3d6d7c

EVALUATION http://hg.openjdk.java.net/jdk7/hotspot-gc/hotspot/rev/6270f80a7331

EVALUATION See Description.