Integrated: 8342283: CDS cannot handle a large number of classes
Aleksey Shipilev
shade at openjdk.org
Tue Apr 29 18:10:57 UTC 2025
On Fri, 25 Apr 2025 14:49:37 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
> 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`
This pull request has now been integrated.
Changeset: ead67574
Author: Aleksey Shipilev <shade at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/ead6757486fb58f35f6e93b691519673bca1a549
Stats: 166 lines in 4 files changed: 156 ins; 2 del; 8 mod
8342283: CDS cannot handle a large number of classes
Co-authored-by: Ioi Lam <iklam at openjdk.org>
Reviewed-by: iklam, lmesnik, ccheung
-------------
PR: https://git.openjdk.org/jdk/pull/24877
More information about the hotspot-dev
mailing list