< prev index next >

test/hotspot/jtreg/vmTestbase/gc/gctests/WeakReferenceGC/WeakReferenceGC.java

Print this page
rev 59094 : imported patch randomness-keyword_vmTestbase_gc
rev 59095 : imported patch 8243430.00
   1 /*
   2  * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  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 /*
  26  * @test
  27  * @key gc
  28  *
  29  * @summary converted from VM Testbase gc/gctests/WeakReferenceGC.
  30  * VM Testbase keywords: [gc, nonconcurrent]
  31  * VM Testbase readme:
  32  * *******************************************
  33  * set timeout = 25 when running this test
  34  * *******************************************
  35  * This tests checks to see if the garbage collector enqueues
  36  * a weak reference when referrent has been turned to garbage.
  37  * Weak references are enqueued in  a non-deterministic way
  38  * by the garbage collector, so the test uses a heuristic to
  39  * determine whether the references are being enqueued in a timely
  40  * manner which in turn determines whether outcome of the test.
  41  * IF the user invokes the test with the following command line
  42  * parameters :
  43  *   java WeakReferenceGC -qFactor 0.9 -gcCount 5
  44  * the test expects that 90% of all objects with only weak references
  45  * pointing to them will be enqueued within 5 calls to the garbage collector.
  46  * When I ran the test, I consistently got figures of 98% enqueueing
  47  * with just 1 call to the garbage collector. So if this test fails,


   1 /*
   2  * Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  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 /*
  26  * @test
  27  * @key gc randomness
  28  *
  29  * @summary converted from VM Testbase gc/gctests/WeakReferenceGC.
  30  * VM Testbase keywords: [gc, nonconcurrent]
  31  * VM Testbase readme:
  32  * *******************************************
  33  * set timeout = 25 when running this test
  34  * *******************************************
  35  * This tests checks to see if the garbage collector enqueues
  36  * a weak reference when referrent has been turned to garbage.
  37  * Weak references are enqueued in  a non-deterministic way
  38  * by the garbage collector, so the test uses a heuristic to
  39  * determine whether the references are being enqueued in a timely
  40  * manner which in turn determines whether outcome of the test.
  41  * IF the user invokes the test with the following command line
  42  * parameters :
  43  *   java WeakReferenceGC -qFactor 0.9 -gcCount 5
  44  * the test expects that 90% of all objects with only weak references
  45  * pointing to them will be enqueued within 5 calls to the garbage collector.
  46  * When I ran the test, I consistently got figures of 98% enqueueing
  47  * with just 1 call to the garbage collector. So if this test fails,


< prev index next >