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.

This pull request has now been integrated.

Changeset: 5db36ced
Author:    Hannes Wallnöfer <hann...@openjdk.org>
URL:       
https://git.openjdk.java.net/jdk/commit/5db36cedc91d0954ececd309a5f8f59ea828f6c1
Stats:     42 lines in 3 files changed: 8 ins; 19 del; 15 mod

8272158: SoftReference related bugs under memory pressure

Reviewed-by: jjg

-------------

PR: https://git.openjdk.java.net/jdk/pull/5080

Reply via email to