JDK-8330670 : Obsolete ScavengeBeforeFullGC
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 23
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-04-19
  • Updated: 2024-04-30
  • Resolved: 2024-04-24
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 23
23 b20Fixed
Related Reports
CSR :  
Relates :  
Relates :  
Sub Tasks
JDK-8330807 :  
Description
This flag controls whether to initiate a young-gc cycle before starting a full-gc cycle.

This flag is enable by default only for Parallel.

```
  if (!UseParallelGC && FLAG_IS_DEFAULT(ScavengeBeforeFullGC)) {
    FLAG_SET_DEFAULT(ScavengeBeforeFullGC, false);
  }
```

Its manual is incorrect and the rational for keeping it on has become outdated.

```
-XX:+ScavengeBeforeFullGC
    Enables GC of the young generation before each full GC. This option is enabled by default. It is recommended that you don't disable it, because scavenging the young generation before a full GC can reduce the number of objects reachable from the old generation space into the young generation space. To disable GC of the young generation before each full GC, specify the option -XX:-ScavengeBeforeFullGC.
```

When Parallel full-gc is single-threaded, it can be beneficial to kick-off a fast young-gc to group live objects together to speed up full-gc. However, nowadays Parallel full-gc is multiple-threads, the cost of an extra young-gc cycle often outweigh its benefit.
Comments
Changeset: 7bb59dc8 Author: Albert Mingkun Yang <ayang@openjdk.org> Date: 2024-04-24 09:44:26 +0000 URL: https://git.openjdk.org/jdk/commit/7bb59dc8da0c61c5da5c3aab5d56a6e4880001ce
24-04-2024

I think this issue is related to CMS which full gc has been single-threaded. This option is typically listed in the hand-me-down CMS options lists.
22-04-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/18861 Date: 2024-04-19 11:53:15 +0000
19-04-2024