< prev index next >

src/java.desktop/share/classes/sun/java2d/marlin/ByteArrayCache.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -97,11 +97,11 @@
         private final ByteArrayCache cache;
 
         Reference(final ByteArrayCache cache, final int initialSize) {
             this.cache = cache;
             this.clean = cache.clean;
-            this.initial = createArray(initialSize, clean);
+            this.initial = createArray(initialSize);
             if (DO_STATS) {
                 cache.stats.totalInitial += initialSize;
             }
         }
 

@@ -114,11 +114,11 @@
             }
             if (DO_LOG_OVERSIZE) {
                 logInfo(getLogPrefix(clean) + "ByteArrayCache: "
                         + "getArray[oversize]: length=\t" + length);
             }
-            return createArray(length, clean);
+            return createArray(length);
         }
 
         byte[] widenArray(final byte[] array, final int usedSize,
                           final int needSize)
         {

@@ -200,11 +200,11 @@
                 return array;
             }
             if (DO_STATS) {
                 stats.createOp++;
             }
-            return createArray(arraySize, clean);
+            return createArray(arraySize);
         }
 
         void putArray(final byte[] array)
         {
             if (DO_CHECKS && (array.length != arraySize)) {

@@ -227,16 +227,12 @@
                         + "array capacity exceeded !");
             }
         }
     }
 
-    static byte[] createArray(final int length, final boolean clean) {
-        if (clean) {
-            return new byte[length];
-        }
-        // use JDK9 Unsafe.allocateUninitializedArray(class, length):
-        return (byte[]) OffHeapArray.UNSAFE.allocateUninitializedArray(byte.class, length);
+    static byte[] createArray(final int length) {
+        return new byte[length];
     }
 
     static void fill(final byte[] array, final int fromIndex,
                      final int toIndex, final byte value)
     {
< prev index next >