RFR: JDK-8272158: SoftReference related bugs under memory pressure
Hannes Wallnöfer
hannesw at openjdk.java.net
Wed Aug 11 10:42:48 UTC 2021
This change fixes two problems related to usage of soft references in javadoc.
The one in `VisibleMemberTable` is rather trivial, it just avoids getting the softly referenced value twice, which allowed GC to clear the reference between the two calls.
For the one in `CommentHelper`, I considered a few different solutions: Store CommentHelper instances with hard references, compute the overridden element information on demand instead of storing it in the object, or ignore missing overridden object info based on the rationale that any issues should already have been reported on the overridden element itself. I decided to go with the on-demand lookup of overridden elements as the additional overhead was minimal (a total of 3 milliseconds for the JDK docs) and the reduction in state/complexity seemed like an additional benefit.
I labeled the issue as "noreg-hard". To test the fix I ran the JDK `docs` target with reduced heap space (appending `-Xmx664m` to `$1_JAVA_ARGS` in make/Docs.gmk). With max heap values in that range, the task either succeeds or fails with `OutOfMemoryError`. Previously, it sometimes failed with `NullPointerException` due to one of the two issues.
-------------
Commit messages:
- JDK-8272158: SoftReference related bugs under memory pressure
Changes: https://git.openjdk.java.net/jdk/pull/5080/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=5080&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8272158
Stats: 42 lines in 3 files changed: 8 ins; 19 del; 15 mod
Patch: https://git.openjdk.java.net/jdk/pull/5080.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/5080/head:pull/5080
PR: https://git.openjdk.java.net/jdk/pull/5080
More information about the javadoc-dev
mailing list