< prev index next >

test/gc/TestSoftReferencesBehaviorOnOOME.java

Print this page




  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /**
  25  * @test TestSoftReferencesBehaviorOnOOME
  26  * @key gc
  27  * @summary Tests that all SoftReferences has been cleared at time of OOM.
  28  * @library /testlibrary
  29  * @modules java.base/sun.misc
  30  *          java.management
  31  * @ignore 8073669
  32  * @build TestSoftReferencesBehaviorOnOOME
  33  * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 512 2k
  34  * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 128k 256k
  35  * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 2k 32k 10
  36  */
  37 import com.oracle.java.testlibrary.Utils;
  38 import java.lang.ref.SoftReference;
  39 import java.util.LinkedList;
  40 import java.util.Random;
  41 
  42 public class TestSoftReferencesBehaviorOnOOME {
  43 
  44     private static final Random rndGenerator = Utils.getRandomInstance();
  45 
  46     public static void main(String[] args) {
  47         int semiRefAllocFrequency = DEFAULT_FREQUENCY;
  48         long minSize = DEFAULT_MIN_SIZE,
  49                 maxSize = DEFAULT_MAX_SIZE;
  50 
  51         if ( args.length >= 3 ) {
  52             semiRefAllocFrequency = Integer.parseInt(args[2]);
  53         }
  54 
  55         if ( args.length >= 2) {
  56             maxSize = getBytesCount(args[1]);
  57         }




  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /**
  25  * @test TestSoftReferencesBehaviorOnOOME
  26  * @key gc
  27  * @summary Tests that all SoftReferences has been cleared at time of OOM.
  28  * @library /testlibrary
  29  * @modules java.base/sun.misc
  30  *          java.management
  31  * @ignore 8073669
  32  * @build TestSoftReferencesBehaviorOnOOME
  33  * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 512 2k
  34  * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 128k 256k
  35  * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 2k 32k 10
  36  */
  37 import jdk.test.lib.Utils;
  38 import java.lang.ref.SoftReference;
  39 import java.util.LinkedList;
  40 import java.util.Random;
  41 
  42 public class TestSoftReferencesBehaviorOnOOME {
  43 
  44     private static final Random rndGenerator = Utils.getRandomInstance();
  45 
  46     public static void main(String[] args) {
  47         int semiRefAllocFrequency = DEFAULT_FREQUENCY;
  48         long minSize = DEFAULT_MIN_SIZE,
  49                 maxSize = DEFAULT_MAX_SIZE;
  50 
  51         if ( args.length >= 3 ) {
  52             semiRefAllocFrequency = Integer.parseInt(args[2]);
  53         }
  54 
  55         if ( args.length >= 2) {
  56             maxSize = getBytesCount(args[1]);
  57         }


< prev index next >