< prev index next >

test/gc/cms/TestBubbleUpRef.java

Print this page




  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 import java.lang.ref.ReferenceQueue;
  25 import java.lang.ref.WeakReference;
  26 import java.util.LinkedList;
  27 import java.util.ListIterator;
  28 
  29 /*
  30  * @test
  31  * @requires vm.gc.ConcMarkSweep
  32  * @key cte_test
  33  * @bug 4950157
  34  * @summary Stress the behavior of ergonomics when the heap is nearly full and
  35  *          stays nearly full.
  36  * @run main/othervm
  37  *  -XX:+UseConcMarkSweepGC -XX:-CMSYield -XX:-CMSPrecleanRefLists1
  38  *  -XX:CMSInitiatingOccupancyFraction=0 -Xmx8m TestBubbleUpRef 16000 50 10000
  39  */
  40 
  41 /**
  42  * Test program to stress the behavior of ergonomics when the
  43  * heap is nearly full and stays nearly full.
  44  * This is a test to catch references that have been discovered
  45  * during concurrent marking and whose referents have been
  46  * cleared by the mutator.
  47  * Allocate objects with weak references until the heap is full
  48  * Free the objects.
  49  * Do work so that concurrent marking has a chance to work
  50  * Clear the referents out of the weak references
  51  * System.gc() in the hopes that it will acquire the collection
  52  * Free the weak references
  53  * Do it again.
  54  *
  55  * Use the following VM options
  56  *     -Xmx8m -XX:-CMSYield [-XX:+UseConcMarkSweepGC] -XX:-CMSPrecleanRefLists1
  57  *      -XX:CMSInitiatingOccupancyFraction=0
  58  *
  59  * Use parameter:
  60  *     args[0] - array size  (16000)
  61  *     args[1] - iterations  (50)
  62  *     args[2] - work        (10000)
  63  */
  64 class MyList extends LinkedList {
  65 
  66     int[] a;
  67 
  68     MyList(int size) {
  69         a = new int[size];
  70     }
  71 }
  72 
  73 class MyRefList extends LinkedList {
  74 
  75     WeakReference ref;
  76 




  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 import java.lang.ref.ReferenceQueue;
  25 import java.lang.ref.WeakReference;
  26 import java.util.LinkedList;
  27 import java.util.ListIterator;
  28 
  29 /*
  30  * @test
  31  * @requires vm.gc.ConcMarkSweep
  32  * @key cte_test
  33  * @bug 4950157
  34  * @summary Stress the behavior of ergonomics when the heap is nearly full and
  35  *          stays nearly full.
  36  * @run main/othervm
  37  *  -XX:+UseConcMarkSweepGC -XX:-CMSYield -XX:-CMSPrecleanRefLists1
  38  *  -XX:CMSInitiatingOccupancyFraction=0 -Xmx80m TestBubbleUpRef 16000 50 10000
  39  */
  40 
  41 /**
  42  * Test program to stress the behavior of ergonomics when the
  43  * heap is nearly full and stays nearly full.
  44  * This is a test to catch references that have been discovered
  45  * during concurrent marking and whose referents have been
  46  * cleared by the mutator.
  47  * Allocate objects with weak references until the heap is full
  48  * Free the objects.
  49  * Do work so that concurrent marking has a chance to work
  50  * Clear the referents out of the weak references
  51  * System.gc() in the hopes that it will acquire the collection
  52  * Free the weak references
  53  * Do it again.
  54  *
  55  * Use the following VM options
  56  *     -Xmx80m -XX:-CMSYield [-XX:+UseConcMarkSweepGC] -XX:-CMSPrecleanRefLists1
  57  *      -XX:CMSInitiatingOccupancyFraction=0
  58  *
  59  * Use parameter:
  60  *     args[0] - array size  (16000)
  61  *     args[1] - iterations  (50)
  62  *     args[2] - work        (10000)
  63  */
  64 class MyList extends LinkedList {
  65 
  66     int[] a;
  67 
  68     MyList(int size) {
  69         a = new int[size];
  70     }
  71 }
  72 
  73 class MyRefList extends LinkedList {
  74 
  75     WeakReference ref;
  76 


< prev index next >