JDK-8344548 : Incorrect StartAggressiveSweepingAt doc for segmented code cache
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,17,21,24
  • Priority: P5
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-11-19
  • Updated: 2025-07-22
  • Resolved: 2025-07-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 26
26 b06Fixed
Related Reports
Relates :  
Description
The `StartAggressiveSweepingAt` documentation:

```
  product(uintx, StartAggressiveSweepingAt, 10,                             \
          "Start aggressive sweeping if X[%] of the code cache is free."    \
          "Segmented code cache: X[%] of the non-profiled heap."            \
          "Non-segmented code cache: X[%] of the total code cache")         \
```

It says that in a case of the segmented code cache the percent of the free space of the non-profile heap is used to trigger sweeping.

This is incorrect because according to the code: https://github.com/openjdk/jdk/blob/996790c70f902d7840d0649a6b0867bed47c6537/src/hotspot/share/code/codeCache.cpp#L782
```
void CodeCache::gc_on_allocation() {
  ...
  size_t free = unallocated_capacity();
  size_t max = max_capacity();
  size_t used = max - free;
  double free_ratio = double(free) / double(max);
  if (free_ratio <= StartAggressiveSweepingAt / 100.0)  {
```
the usage of all allocable heaps is taken into account. `unallocated_capacity` and `max_capacity` traverse all such code heaps. 
Comments
Changeset: 27e6a4d2 Branch: master Author: han gq <hanguanqiang@kylinos.cn> Committer: Evgeny Astigeevich <eastigeevich@openjdk.org> Date: 2025-07-08 11:50:09 +0000 URL: https://git.openjdk.org/jdk/commit/27e6a4d2f7a4bdd12408e518e86aeb623f1c41bc
08-07-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/26114 Date: 2025-07-03 11:29:02 +0000
03-07-2025

ILW = Incorrect documentation for command line option, StartAggressiveSweepingAt with segmented code cache, no workaround = LLH = P5
22-11-2024