< prev index next >

test/hotspot/jtreg/gc/z/TestUncommit.java

Print this page
rev 59879 : [mq]: 8249000


   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 package gc.z;
  25 
  26 /*
  27  * @test TestUncommit
  28  * @requires vm.gc.Z & !vm.graal.enabled
  29  * @summary Test ZGC uncommit unused memory
  30  * @run main/othervm -XX:+UseZGC -Xlog:gc*,gc+heap=debug,gc+stats=off -Xms128M -Xmx512M -XX:ZUncommitDelay=10 gc.z.TestUncommit true 2
  31  */
  32 
  33 /*
  34  * @test TestUncommit
  35  * @requires vm.gc.Z & !vm.graal.enabled
  36  * @summary Test ZGC uncommit unused memory
  37  * @run main/othervm -XX:+UseZGC -Xlog:gc*,gc+heap=debug,gc+stats=off -Xms512M -Xmx512M -XX:ZUncommitDelay=10 gc.z.TestUncommit false 1
  38  */
  39 
  40 /*
  41  * @test TestUncommit
  42  * @requires vm.gc.Z & !vm.graal.enabled
  43  * @summary Test ZGC uncommit unused memory
  44  * @run main/othervm -XX:+UseZGC -Xlog:gc*,gc+heap=debug,gc+stats=off -Xms128M -Xmx512M -XX:ZUncommitDelay=10 -XX:-ZUncommit gc.z.TestUncommit false 1
  45  */
  46 
  47 import java.util.ArrayList;
  48 
  49 public class TestUncommit {
  50     private static final int delay = 10; // seconds
  51     private static final int allocSize = 200 * 1024 * 1024; // 200M
  52     private static final int smallObjectSize = 4 * 1024; // 4K
  53     private static final int mediumObjectSize = 2 * 1024 * 1024; // 2M
  54     private static final int largeObjectSize = allocSize;
  55 
  56     private static volatile ArrayList<byte[]> keepAlive;
  57 
  58     private static long capacity() {
  59         return Runtime.getRuntime().totalMemory();
  60     }
  61 
  62     private static void allocate(int objectSize) {




   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 package gc.z;
  25 
  26 /*
  27  * @test TestUncommit
  28  * @requires vm.gc.Z
  29  * @summary Test ZGC uncommit unused memory
  30  * @run main/othervm -XX:+UseZGC -Xlog:gc*,gc+heap=debug,gc+stats=off -Xms128M -Xmx512M -XX:ZUncommitDelay=10 gc.z.TestUncommit true 2
  31  */
  32 
  33 /*
  34  * @test TestUncommit
  35  * @requires vm.gc.Z
  36  * @summary Test ZGC uncommit unused memory
  37  * @run main/othervm -XX:+UseZGC -Xlog:gc*,gc+heap=debug,gc+stats=off -Xms512M -Xmx512M -XX:ZUncommitDelay=10 gc.z.TestUncommit false 1
  38  */
  39 
  40 /*
  41  * @test TestUncommit
  42  * @requires vm.gc.Z
  43  * @summary Test ZGC uncommit unused memory
  44  * @run main/othervm -XX:+UseZGC -Xlog:gc*,gc+heap=debug,gc+stats=off -Xms128M -Xmx512M -XX:ZUncommitDelay=10 -XX:-ZUncommit gc.z.TestUncommit false 1
  45  */
  46 
  47 import java.util.ArrayList;
  48 
  49 public class TestUncommit {
  50     private static final int delay = 10; // seconds
  51     private static final int allocSize = 200 * 1024 * 1024; // 200M
  52     private static final int smallObjectSize = 4 * 1024; // 4K
  53     private static final int mediumObjectSize = 2 * 1024 * 1024; // 2M
  54     private static final int largeObjectSize = allocSize;
  55 
  56     private static volatile ArrayList<byte[]> keepAlive;
  57 
  58     private static long capacity() {
  59         return Runtime.getRuntime().totalMemory();
  60     }
  61 
  62     private static void allocate(int objectSize) {


< prev index next >