< prev index next >

test/gc/TestSoftReferencesBehaviorOnOOME.java

Print this page




   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  * @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/jdk.internal.misc
  30  *          java.management
  31  * @build TestSoftReferencesBehaviorOnOOME
  32  * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 512 2k
  33  * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 128k 256k
  34  * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 2k 32k
  35  */
  36 import jdk.test.lib.Utils;
  37 import jdk.test.lib.Asserts;
  38 import java.lang.ref.SoftReference;
  39 import java.util.LinkedList;
  40 import java.util.Random;
  41 
  42 public class TestSoftReferencesBehaviorOnOOME {
  43 
  44     /**
  45      * Test generates a lot of soft references to objects with random payloads.
  46      * Then it provokes OOME and checks that all SoftReferences has been gone
  47      * @param args - [minSize] [maxSize] [freq]
  48      *  where
  49      *  - minSize - min size of random objects
  50      *  - maxSize - max size of random objects
  51      */




   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  * @test TestSoftReferencesBehaviorOnOOME
  26  * @key gc
  27  * @summary Tests that all SoftReferences has been cleared at time of OOM.
  28  * @library /test/lib
  29  * @modules java.base/jdk.internal.misc
  30  *          java.management

  31  * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 512 2k
  32  * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 128k 256k
  33  * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 2k 32k
  34  */
  35 import jdk.test.lib.Utils;
  36 import jdk.test.lib.Asserts;
  37 import java.lang.ref.SoftReference;
  38 import java.util.LinkedList;
  39 import java.util.Random;
  40 
  41 public class TestSoftReferencesBehaviorOnOOME {
  42 
  43     /**
  44      * Test generates a lot of soft references to objects with random payloads.
  45      * Then it provokes OOME and checks that all SoftReferences has been gone
  46      * @param args - [minSize] [maxSize] [freq]
  47      *  where
  48      *  - minSize - min size of random objects
  49      *  - maxSize - max size of random objects
  50      */


< prev index next >