RFR: 8291457: Clean up lifecycle of CDS dump-time data structures
Ioi Lam
iklam at openjdk.org
Wed Aug 3 07:28:21 UTC 2022
I've rewritten the following data CDS structures to follow the [C++ rule-of-three](https://en.cppreference.com/w/cpp/language/rule_of_three) to improve their lifecycle handling and fix a memory leak. This is done to prepare for future CDS changes that make more allocations during archive creation.
> Rule of Three: If a class requires a user-defined destructor, a user-defined copy constructor, or a user-defined copy assignment operator, it almost certainly requires all three.
- DumpTimeClassInfo
- DumpTimeClassInfo::DTLoaderConstraint
- DumpTimeClassInfo::DTVerifierConstraint
- DumpTimeLambdaProxyClassInfo
I implemented some of the assignment operators using the [copy-and-swap idiom](https://en.cppreference.com/w/cpp/language/copy_assignment) to handle `Symbol` refcounting. Thanks to @kimbarrett for the suggestion.
-------------
Commit messages:
- added operator= to complete the rule-of-three
- use c++ copy-and-swap idiom
- lint
- fixed c++
- 8291457: Clean up lifecycle of CDS dump-time data structures
Changes: https://git.openjdk.org/jdk/pull/9722/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=9722&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8291457
Stats: 195 lines in 6 files changed: 91 ins; 42 del; 62 mod
Patch: https://git.openjdk.org/jdk/pull/9722.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/9722/head:pull/9722
PR: https://git.openjdk.org/jdk/pull/9722
More information about the hotspot-runtime-dev
mailing list