Use this method to SHARE (not copy) the incoming array.
975719
def set_data(self, data_np, metadata=None, order=None, astype=None):
        
        if astype:
            data = data_np.astype(astype, copy=False)
        else:
            data = data_np
        self._data = data

        self._calc_order(order)

        if metadata:
            self.update_metadata(metadata)

        self._set_minmax()

        self.make_callback('modified')
583550
public static void shuffle(final Object[] array) {
    synchronized (array) {
      // asList uses the backing array as store,
      // therefore changes to the list are reflected by the array.
      Collections.shuffle(Arrays.asList(array), random);
    }
  }
327927
function () {
        var data = this.data;
        if (data instanceof Array) {
            data.length = this._len;
            if (hasTypedArray) {
                this.data = new Float32Array(data);
            }
        }
    }
362514
protected function saveStatsArray() {
        if (is_array($this->stats)) {
            $this->instance->saveStatus($this->cacheKeyPrefix, $this->cacheKeySuffix, serialize($this->stats), true);
        }
    }
807074
private void growLonePairArray() {
        growArraySize = (lonePairs.length < growArraySize) ? growArraySize : lonePairs.length;
        ILonePair[] newLonePairs = new ILonePair[lonePairs.length + growArraySize];
        System.arraycopy(lonePairs, 0, newLonePairs, 0, lonePairs.length);
        lonePairs = newLonePairs;
    }
417243
public static void copyToArray(Collection<Object> collection, Object[] objects)
	{
		System.arraycopy(collection.toArray(), 0, objects, 0, objects.length);
	}
985083
public void putAll(ArrayMap<? extends K, ? extends V> array) {
        final int N = array.mSize;
        ensureCapacity(mSize + N);
        if (mSize == 0) {
            if (N > 0) {
                System.arraycopy(array.mHashes, 0, mHashes, 0, N);
                System.arraycopy(array.mArray, 0, mArray, 0, N<<1);
                mSize = N;
            }
        } else {
            for (int i=0; i<N; i++) {
                put(array.keyAt(i), array.valueAt(i));
            }
        }
    }
797912
@Override
    @SuppressWarnings("unchecked")
    protected void ensureCapacity(int capacity) {
        checkCapacity(capacity);
        K[] newArray = (K[]) new Object[capacity + 1];
        System.arraycopy(array, 1, newArray, 1, size);
        array = newArray;
    }
1305397
@SuppressWarnings("unchecked")
    public static <T> T[] copyOf(T[] array, int length) {
        T[] newArray = (T[]) Array.newInstance(array.getClass().getComponentType(), length);
        System.arraycopy(array, 0, newArray, 0, Math.min(length, array.length));
        return newArray;
    }
790767
public byte[] toArray() {
    byte[] copy = new byte[length];
    System.arraycopy(data, offset, copy, 0, length);
    return copy;
  }
141520
public static Object[] copyArray(Object[] array, int from, int to) {
    Object[] result = new Object[to - from];
    System.arraycopy(array, from, result, 0, to - from);
    return result;
  }
363716
public static final Bytes of(byte[] array) {
    Objects.requireNonNull(array);
    if (array.length == 0) {
      return EMPTY;
    }
    byte[] copy = new byte[array.length];
    System.arraycopy(array, 0, copy, 0, array.length);
    return new Bytes(copy);
  }
215569
function share() {
    var status = $.trim($('#status').val()),
        target = $('#target').val();

    // Nothing to share
    if(status === '') {
      return;
    }

    // When messaging an individual user, update the target to be the user
    // that is being messaged.
    if(target === 'user') {
      target = $('#target_user').val();
    }

    // Dispatch the message to the server.
    socket.emit('post', status, target);

    // Clear the status input for the next message.
    $('#status').val('');
  }
709597
@Override
    public void receiveUpdate(INDArray array) {
        extCounter.getAndIncrement();

        updatesLock.writeLock().lock();

        if (updates == null) {
            try (MemoryWorkspace workspace = Nd4j.getMemoryManager().scopeOutOfWorkspaces()) {
                // TODO: this one has to be HOST-only if P2P is NOT supported
                updates = Nd4j.create(array.shape(), array.ordering());
            }
        }

        hasSomething.compareAndSet(false, true);

        // if P2P is NOT supported - this call should be handled with cpu
        updates.addi(array);

        // we have to ensure, all operations were finished here
        Nd4j.getExecutioner().commit();

        updatesLock.writeLock().unlock();
    }
354473
function copyArray$1(source, array) {
  var index = -1,
      length = source.length;

  array || (array = Array(length));
  while (++index < length) {
    array[index] = source[index];
  }
  return array;
}
241994
function releaseArray(array) {
    array.length = 0;
    if (arrayPool.length < MAX_POOL_SIZE) {
      arrayPool.push(array);
    }
  }
512631
@Override
    public void collect(INDArray... arrays) {
        // we basically want to free memory, without touching INDArray itself.
        // so we don't care when gc is going to release object: memory is already cached

        Nd4j.getExecutioner().commit();

        int cnt = -1;
        AtomicAllocator allocator = AtomicAllocator.getInstance();
        for (INDArray array : arrays) {
            cnt++;
            // we don't collect views, since they don't have their own memory
            if (array == null || array.isView())
                continue;

            AllocationPoint point = allocator.getAllocationPoint(array);

            if (point.getAllocationStatus() == AllocationStatus.HOST)
                allocator.getMemoryHandler().free(point, AllocationStatus.HOST);
            else if (point.getAllocationStatus() == AllocationStatus.DEVICE) {
                allocator.getMemoryHandler().free(point, AllocationStatus.DEVICE);
                allocator.getMemoryHandler().free(point, AllocationStatus.HOST);
            } else if (point.getAllocationStatus() == AllocationStatus.DEALLOCATED) {
                // do nothing
            } else
                throw new RuntimeException(
                                "Unknown AllocationStatus: " + point.getAllocationStatus() + " for argument: " + cnt);

            point.setAllocationStatus(AllocationStatus.DEALLOCATED);
        }
    }