Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDK-8272158: SoftReference related bugs under memory pressure #5080

wants to merge 1 commit into from


Copy link

@hns hns commented Aug 11, 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.


  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed


  • JDK-8272158: SoftReference related bugs under memory pressure



Using git

Checkout this PR locally:
$ git fetch pull/5080/head:pull/5080
$ git checkout pull/5080

Update a local copy of the PR:
$ git checkout pull/5080
$ git pull pull/5080/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 5080

View PR using the GUI difftool:
$ git pr show -t 5080

Using diff file

Download this PR as a diff file:

Copy link

@bridgekeeper bridgekeeper bot commented Aug 11, 2021

👋 Welcome back hannesw! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.


@openjdk openjdk bot added the rfr label Aug 11, 2021
Copy link

@openjdk openjdk bot commented Aug 11, 2021

@hns The following label will be automatically applied to this pull request:

  • javadoc

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.


@openjdk openjdk bot added the javadoc label Aug 11, 2021
Copy link

@mlbridge mlbridge bot commented Aug 11, 2021



Copy link

@jonathan-gibbons jonathan-gibbons left a comment

Maybe we should have a general review of the use of SoftReference and WeakReference in javadoc and the standard doclet.


Copy link

@openjdk openjdk bot commented Aug 13, 2021

@hns This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file for details.

After integration, the commit message for the final commit will be:

8272158: SoftReference related bugs under memory pressure

Reviewed-by: jjg

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 27 new commits pushed to the master branch:

  • d06d0b9: 8272112: Arena code simplifications
  • 0c4be76: 8058704: Nimbus does not honor JTextPane background color
  • 020aec5: 8271366: [REDO] JDK-8266054 VectorAPI rotate operation optimization
  • 4d4ba5c: 8272116: Update PerfDisableSharedMem with FLAG_SET_ERGO in PerfMemory::create_memory_region
  • 09ab86b: 8269909: getStack method in hprof.parser.Reader should use try-with-resource
  • e4766ee: 8272391: Undeleted debug information
  • 428d516: 8140241: (fc) Data transfer from FileChannel to itself causes hang in case of overlap
  • 93cab7d: 8272315: Improve assert_different_registers
  • 9980b41: 8272107: Removal of Unsafe::defineAnonymousClass left a dangling C++ class
  • 464e874: 8048190: NoClassDefFoundError omits original ExceptionInInitializerError
  • ... and 17 more:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.


@openjdk openjdk bot added the ready label Aug 13, 2021
Copy link
Member Author

@hns hns commented Aug 16, 2021



Copy link

@openjdk openjdk bot commented Aug 16, 2021

Going to push as commit 5db36ce.
Since your change was applied there have been 38 commits pushed to the master branch:

  • 7a5b37b: 8272439: G1: add documentation to G1CardSetInlinePtr
  • 0209d9f: 8272461: G1: remove empty declaration of cleanup_after_scan_heap_roots
  • 36e2dda: 8272348: Update CDS tests in anticipation of JDK-8270489
  • 3f38a50: 8271203: C2: assert(iff->Opcode() == Op_If || iff->Opcode() == Op_CountedLoopEnd || iff->Opcode() == Op_RangeCheck) failed: Check this code when new subtype is added
  • 6a5241c: 8272491: Problem list javax/swing/JFrame/NSTexturedJFrame/ on macos
  • 17b9350: 8266079: Lanai: AlphaComposite shows differences on Metal compared to OpenGL
  • 87d2761: 8271883: Math CopySign optimization for x86
  • 6b8b160: 8272396: mismatching debug output streams
  • 0af645a: 8205138: Remove Applet references from Font2DTest
  • bd7f9b4: 8272459: ProblemList compiler/codecache/ on aarch64
  • ... and 28 more:

Your commit was automatically rebased without conflicts.


@openjdk openjdk bot closed this Aug 16, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Aug 16, 2021
Copy link

@openjdk openjdk bot commented Aug 16, 2021

@hns Pushed as commit 5db36ce.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants