Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8164712

SoftRefLRUPolicyMSPerMB=0 does not discard after a full GC

XMLWordPrintable

    • gc
    • x86
    • os_x

      FULL PRODUCT VERSION :
      java version "9-ea"
      Java(TM) SE Runtime Environment (build 9-ea+131)
      Java HotSpot(TM) 64-Bit Server VM (build 9-ea+131, mixed mode)

      FULL OS VERSION :
      Darwin Bens-MacBook-Pro.local 15.6.0 Darwin Kernel Version 15.6.0: Thu Jun 23 18:25:34 PDT 2016; root:xnu-3248.60.10~1/RELEASE_X86_64 x86_64

      A DESCRIPTION OF THE PROBLEM :
      Unit tests are run with SoftRefLRUPolicyMSPerMB=0 so that soft references are treated as weak references. When a full GC is triggered and a weak reference is observed to be cleaned, the softly reachable references should also no longer be present. This works on JDK8.

      In JDK9 this behavior is no longer honored and the test cases fail. See ReferenceTest [1] for details.

      The use-case is a caching library supporting reference-based caching. This JVM flag was the only predictable way to test the soft reference code path. The failure occurs when running the tests against Google's Guava and Caffeine (the latter being a rewrite).

      [1] https://github.com/ben-manes/caffeine/blob/master/caffeine/src/test/java/com/github/benmanes/caffeine/cache/ReferenceTest.java

      REGRESSION. Last worked in version 8u102

      REPRODUCIBILITY :
      This bug can be reproduced always.

            jmasa Jon Masamitsu (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: