< prev index next >

test/gc/TestSoftReferencesBehaviorOnOOME.java

Print this page




   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  * @test TestSoftReferencesBehaviorOnOOME
  26  * @key gc
  27  * @summary Tests that all SoftReferences has been cleared at time of OOM.
  28  * @library /testlibrary
  29  * @build TestSoftReferencesBehaviorOnOOME
  30  * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 512 2k
  31  * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 128k 256k
  32  * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 2k 32k 10
  33  */
  34 import com.oracle.java.testlibrary.Utils;
  35 import java.lang.ref.SoftReference;
  36 import java.util.LinkedList;
  37 import java.util.Random;
  38 
  39 public class TestSoftReferencesBehaviorOnOOME {
  40 
  41     private static final Random rndGenerator = Utils.getRandomInstance();
  42 
  43     public static void main(String[] args) {
  44         int semiRefAllocFrequency = DEFAULT_FREQUENCY;
  45         long minSize = DEFAULT_MIN_SIZE,
  46                 maxSize = DEFAULT_MAX_SIZE;
  47 
  48         if ( args.length >= 3 ) {
  49             semiRefAllocFrequency = Integer.parseInt(args[2]);




   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  * @test TestSoftReferencesBehaviorOnOOME
  26  * @key gc
  27  * @summary Tests that all SoftReferences has been cleared at time of OOM.
  28  * @library /testlibrary
  29  * @build com.oracle.java.testlibrary.* TestSoftReferencesBehaviorOnOOME
  30  * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 512 2k
  31  * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 128k 256k
  32  * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 2k 32k 10
  33  */
  34 import com.oracle.java.testlibrary.Utils;
  35 import java.lang.ref.SoftReference;
  36 import java.util.LinkedList;
  37 import java.util.Random;
  38 
  39 public class TestSoftReferencesBehaviorOnOOME {
  40 
  41     private static final Random rndGenerator = Utils.getRandomInstance();
  42 
  43     public static void main(String[] args) {
  44         int semiRefAllocFrequency = DEFAULT_FREQUENCY;
  45         long minSize = DEFAULT_MIN_SIZE,
  46                 maxSize = DEFAULT_MAX_SIZE;
  47 
  48         if ( args.length >= 3 ) {
  49             semiRefAllocFrequency = Integer.parseInt(args[2]);


< prev index next >