< prev index next >

test/gc/arguments/AllocationHelper.java

Print this page




   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 package jdk.test.lib;
  25 
  26 import java.util.LinkedList;
  27 import java.util.concurrent.Callable;
  28 
  29 /**
  30  * Helper class which allocates memory.
  31  *
  32  * Typical usage:
  33  * <pre>
  34  * {@code
  35  *           AllocationHelper allocator = new AllocationHelper(MAX_ITERATIONS, ARRAY_LENGTH, CHUNK_SIZE,
  36  *                   () -> (verifier()));
  37  *           // Allocate byte[CHUNK_SIZE] ARRAY_LENGTH times. Total allocated bytes will be CHUNK_SIZE * ARRAY_LENGTH + refs length.
  38  *           // Then invoke verifier and iterate MAX_ITERATIONS times.
  39  *           allocator.allocateMemoryAndVerify();
  40  * }
  41  * </pre>
  42  */
  43 public final class AllocationHelper {
  44 
  45     private final int arrayLength;




   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 import java.util.LinkedList;
  25 import java.util.concurrent.Callable;
  26 
  27 /**
  28  * Helper class which allocates memory.
  29  *
  30  * Typical usage:
  31  * <pre>
  32  * {@code
  33  *           AllocationHelper allocator = new AllocationHelper(MAX_ITERATIONS, ARRAY_LENGTH, CHUNK_SIZE,
  34  *                   () -> (verifier()));
  35  *           // Allocate byte[CHUNK_SIZE] ARRAY_LENGTH times. Total allocated bytes will be CHUNK_SIZE * ARRAY_LENGTH + refs length.
  36  *           // Then invoke verifier and iterate MAX_ITERATIONS times.
  37  *           allocator.allocateMemoryAndVerify();
  38  * }
  39  * </pre>
  40  */
  41 public final class AllocationHelper {
  42 
  43     private final int arrayLength;


< prev index next >