RFR: 8342283: CDS cannot handle a large number of classes [v2]
Aleksey Shipilev
shade at openjdk.org
Mon Apr 28 09:20:38 UTC 2025
> CDS cannot handle large number of classes, because `ClassLoader` data structures get too large for CDS archival. The new test captures such an occasion. We do `clear()`-s, but that is not enough to trim the backing storages for the affected collections.
>
> In contrast with previous attempts to fix this (https://github.com/openjdk/jdk/pull/21797 and my VM-side field overwrite), we can just reinitialize the fields using `Unsafe`, which bypasses normal `final` field write restriction. `ClassLoader` already does a similar thing nearby! This allows us to stay fully in Java, and makes the patch fairly straightforward.
>
> Additional testing:
> - [x] Linux x86_64 server fastdebug, new test reliably fails without the fix, passes with it
> - [x] Linux x86_64 server fastdebug, `runtime/cds`
Aleksey Shipilev has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
- Minor touchup
- Merge branch 'master' into JDK-8342283-cds-many-classes
- Adjust TEST.groups
- Fix
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/24877/files
- new: https://git.openjdk.org/jdk/pull/24877/files/97ab42b6..d45ecd2f
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=24877&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=24877&range=00-01
Stats: 5902 lines in 267 files changed: 3247 ins; 1104 del; 1551 mod
Patch: https://git.openjdk.org/jdk/pull/24877.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/24877/head:pull/24877
PR: https://git.openjdk.org/jdk/pull/24877
More information about the hotspot-dev
mailing list