RFR: 8342283: CDS cannot handle a large number of classes [v2]
Ioi Lam
iklam at openjdk.org
Thu Nov 28 04:06:04 UTC 2024
> When lots of classes are loaded during `java -Xshare:dump`, the internal arrays used by some of the HashMaps and ArrayLists become too large to be archived by CDS (> 256KB).
>
> At the very end of Java bytecode execution during `java -Xshare:dump`, we used to call `clear()` on these tables to free their elements (*) -- these tables are repopulated at run time when classes are loaded incrementally. However, the `clear()` call doesn't resize the internal arrays.
>
> The fix is to re-ininitialize these tables to new, empty tables that have small internal arrays.
>
> ===
> (*) the call to `resetArchivedStates()` is made from [HeapShared::reset_archived_object_states()](https://github.com/openjdk/jdk/blob/688e92e7f5febddd2935cb7f500dd3f10fbd9401/src/hotspot/share/cds/metaspaceShared.cpp#L799)
Ioi Lam has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains three commits:
- Use ArrayList::trimToSize() instead of reallocation; there is no equivalent method for ConcurrentHashMap, though
- Merge branch 'master' into 8342283-cds-cannot-handle-lots-of-classes
- 8342283: CDS cannot handle a large number of classes
-------------
Changes: https://git.openjdk.org/jdk/pull/21797/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=21797&range=01
Stats: 14 lines in 1 file changed: 6 ins; 0 del; 8 mod
Patch: https://git.openjdk.org/jdk/pull/21797.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/21797/head:pull/21797
PR: https://git.openjdk.org/jdk/pull/21797
More information about the core-libs-dev
mailing list