Allocates a new multi array in memory and returns the reference to the base.
333660
def new_array(state, element_type, size, default_value_generator=None):
        
        size_bounded = SimSootExpr_NewMultiArray._bound_multi_array_size(state, size)
        # return the reference of the array base
        # => elements getting lazy initialized in the javavm memory
        return SimSootValue_ArrayBaseRef(heap_alloc_id=state.javavm_memory.get_new_uuid(),
                                         element_type=element_type,
                                         size=size_bounded,
                                         default_value_generator=default_value_generator)
1306002
def new_from_memory(cls, data):
        """"""

        size = len(data)
        copy = g_memdup(data, size)
        ptr = cast(copy, POINTER(guint8))
        try:
            with gerror(GIError) as error:
                return GITypelib._new_from_memory(ptr, size, error)
        except GIError:
            free(copy)
            raise
605260
private int resize(int newSize)
    {
        int[] base2 = new int[newSize];
        int[] check2 = new int[newSize];
        if (allocSize > 0)
        {
            System.arraycopy(base, 0, base2, 0, allocSize);
            System.arraycopy(check, 0, check2, 0, allocSize);
        }

        base = base2;
        check = check2;

        return allocSize = newSize;
    }
1219427
@Override
    public AllocationPoint allocateMemory(DataBuffer buffer, AllocationShape requiredMemory, boolean initialize) {
        // by default we allocate on initial location
        AllocationPoint point = null;

        if (configuration.getMemoryModel() == Configuration.MemoryModel.IMMEDIATE) {
            point = allocateMemory(buffer, requiredMemory, memoryHandler.getInitialLocation(), initialize);
        } else if (configuration.getMemoryModel() == Configuration.MemoryModel.DELAYED) {
            // for DELAYED memory model we allocate only host memory, regardless of firstMemory configuration value
            point = allocateMemory(buffer, requiredMemory, AllocationStatus.HOST, initialize);
        }

        return point;
    }
265547
private byte[] alloc() {
        position = 0;
        chunk++;
        
        if (chunk >= pool.size()) {
            byte[] bytes = new byte[chunk == 0 ? initialSize : incrementalSize];
            pool.add(bytes);
        }
        
        return chunk();
    }
402112
function getMemory(size) {
  if (!staticSealed) return staticAlloc(size);
  if (!runtimeInitialized) return dynamicAlloc(size);
  return _malloc(size);
}
900512
public static WsByteBuffer[] expandBufferArray(WsByteBuffer[] oldList, WsByteBuffer[] newBuffers) {
        if (null == oldList && null == newBuffers) {
            // if both are null then just exit
            return null;
        }

        int oldLen = (null != oldList ? oldList.length : 0);
        int newLen = (null != newBuffers ? newBuffers.length : 0);
        WsByteBuffer[] bb = new WsByteBuffer[oldLen + newLen];
        if (0 < oldLen) {
            System.arraycopy(oldList, 0, bb, 0, oldLen);
        }
        if (0 < newLen) {
            System.arraycopy(newBuffers, 0, bb, oldLen, newLen);
        }
        return bb;
    }
1148876
public MatrixSize readArraySize() throws IOException {
        int numRows = getInt(), numColumns = getInt();

        return new MatrixSize(numRows, numColumns, numRows * numColumns);
    }
434626
public static AllocationShape buildAllocationShape(INDArray array) {
        AllocationShape shape = new AllocationShape();
        shape.setDataType(array.data().dataType());
        shape.setLength(array.length());
        shape.setDataType(array.data().dataType());

        return shape;
    }
522928
def load(self, data, size=None):
        """"""
        self.bind()
        if size is None:
            # ffi's sizeof understands arrays
            size = sizeof(data)
        if size == self.buffer_size:
            # same size - no need to allocate new buffer, just copy
            glBufferSubData(
                self.array_type,
                0,
                size,
                to_raw_pointer(data)
            )
        else:
            # buffer size has changed - need to allocate new buffer in the GPU
            glBufferData(
                self.array_type,
                size,
                to_raw_pointer(data),
                self.draw_type
            )
            self.buffer_size = size
        self.unbind()
50797
function arrayUniq (array) {
  var result = []
  baseExports.each(array, function (value) {
    if (!result.includes(value)) {
      result.push(value)
    }
  })
  return result
}
964216
public byte[] toByteArray()
    {
        byte[] b = new byte[size()];
        unsafe.copyMemory(base, address, b, ARRAY_BYTE_BASE_OFFSET, size());
        return b;
    }
992938
public T alloc() {
    if (numFree == 0) {
      Preconditions.checkState(numAlloc < maxSize);
      numAlloc++;
      return allocator.get();
    } else {
      T item = free[numFree - 1];
      numFree--;
      return item;
    }
  }
1104544
function _allocate(bytes) {
  var address = Module._malloc(bytes.length);
  Module.HEAPU8.set(bytes, address);

  return address;
}
1016100
public static IntBuffer allocate (int capacity) {
        if (capacity < 0) {
            throw new IllegalArgumentException();
        }
        ByteBuffer bb = ByteBuffer.allocateDirect(capacity * 4);
        bb.order(ByteOrder.nativeOrder());
        return bb.asIntBuffer();
    }
561059
private void reallocate(int capacity) {
    if (capacity != elements.length) {
      assert (size <= capacity);
      float[] newArray = new float[capacity];
      for (int i = 0; i < size; i++) {
        newArray[i] = elements[i];
      }
      elements = newArray;
    }
  }
159055
private final void expand_array()
  {
//    if (tc.isEntryEnabled())
//      SibTr.entry(tc, "expand_array");

    int length = m_array.length;
    Object[] m_new = new Object[length*2];
    System.arraycopy(m_array, m_head, m_new, m_head, length-m_head);
    System.arraycopy(m_array, 0, m_new, length, m_tail);
    m_tail += length;
    m_array = m_new;

//    if (tc.isEntryEnabled())
//      SibTr.exit(tc, "expand_array");
  }