On Wed, 11 Aug 2021 10:36:48 GMT, Hannes Wallnöfer <hann...@openjdk.org> wrote:
> 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. Maybe we should have a general review of the use of `SoftReference` and `WeakReference` in javadoc and the standard doclet. ------------- Marked as reviewed by jjg (Reviewer). PR: https://git.openjdk.java.net/jdk/pull/5080