CODETOOLS-7902944: JMH: Avoid direct weak references in Blackhole.consume(Object) #42
+9
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
CODETOOLS-7901867 wrapped the stored object reference with a
WeakReference
. This unfortunately fails with inline type boxes that throw the exceptions like:Wrapping in
WeakReference
is not very reliable, but it is an important defense-in-depth strategy: if it hoards a large object, then a GC in the middle of benchmark would drop it. To handle inline types, it might make some sense to wrap the instance with another holder.Progress
Issue
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jmh pull/42/head:pull/42
$ git checkout pull/42
Update a local copy of the PR:
$ git checkout pull/42
$ git pull https://git.openjdk.java.net/jmh pull/42/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 42
View PR using the GUI difftool:
$ git pr show -t 42
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jmh/pull/42.diff