JDK-8318720 : G1: Memory leak in G1CodeRootSet after JDK-8315503
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 22
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-10-24
  • Updated: 2024-04-19
  • Resolved: 2023-10-25
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 21 JDK 22
21.0.4-oracleFixed 22 b22Fixed
Related Reports
Relates :  
Relates :  
Description
JDK-8315503 replaced ResourceHashTable with ConcurrentHashTable.
When it tries to clear G1CodeRootSetHashTable, it calls ConcurrentHashTable:table.unsafe_reset(). 

The method has comments states:
 // Unsafe reset and resize the table. This method assumes that we
  // want to clear and maybe resize the internal table without the
  // overhead of clearing individual items in the table. 

So, if the table is not empty, then all entries in table are leaked.

Comments
A pull request was submitted for review. URL: https://git.openjdk.org/jdk21u-dev/pull/476 Date: 2024-04-08 20:00:14 +0000
10-04-2024

Fix request [21u] I backport this for parity with 21.0.4-oracle. Required follow-up of JDK-8315503 and included in that backport. Clean backport.
08-04-2024

Changeset: 811b436e Author: Zhengyu Gu <zgu@openjdk.org> Date: 2023-10-25 23:47:46 +0000 URL: https://git.openjdk.org/jdk/commit/811b436e5de972bedd3a0fa25952b2e1beddd9c3
25-10-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/16352 Date: 2023-10-24 23:04:28 +0000
24-10-2023