Protected Allocate
764207
protected function allocate($rgb)
    {
        $rgb = explode('|', $this->getColors($rgb));

        $red   = $rgb[0] ?? 0;
        $green = $rgb[1] ?? 0;
        $blue  = $rgb[2] ?? 0;
        $alpha = $rgb[3] ?? 0;

        return imagecolorallocatealpha($this->canvas, $red, $green, $blue, $alpha);
    }
539313
@Override
  public WritableBuffer allocate(int capacityHint) {
    capacityHint = Math.min(MAX_BUFFER, Math.max(MIN_BUFFER, capacityHint));
    return new OkHttpWritableBuffer(new Buffer(), capacityHint);
  }
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();
    }
533965
private ByteBuf allocateOutNetBuf(ChannelHandlerContext ctx, int pendingBytes, int numComponents) {
        return allocate(ctx, engineType.calculateWrapBufferCapacity(this, pendingBytes, numComponents));
    }
72357
private int allocate(int size)
    {
        while (true)
        {
            int prev = allocatePosition.get();
            int next = prev + size;
            if (next >= buffer.capacity())
                return -1;
            if (allocatePosition.compareAndSet(prev, next))
                return prev;
        }
    }
131489
public synchronized NikeFS2Block allocateBlock() {
		// look for free block, i.e. first block whose index
		// bit is set to true in the allocation map.
		int freeBlockIndex = blockAllocationMap.nextSetBit(0);
		if(freeBlockIndex < 0) {
			// no free blocks left in this provider.
			return null;
		} else {
			// set index bit to false in allocation map,
			// and return in block wrapper.
			blockAllocationMap.set(freeBlockIndex, false);
			return new NikeFS2Block(this, freeBlockIndex);
		}
	}
872468
Allocation allocate(Mutation mutation, int size)
    {
        final OpOrder.Group opGroup = appendOrder.start();
        try
        {
            int position = allocate(size);
            if (position < 0)
            {
                opGroup.close();
                return null;
            }
            markDirty(mutation, position);
            return new Allocation(this, opGroup, position, (ByteBuffer) buffer.duplicate().position(position).limit(position + size));
        }
        catch (Throwable t)
        {
            opGroup.close();
            throw t;
        }
    }
568085
public static ByteBuffer allocate(int capacity) {
        ByteBuffer buf = ByteBuffer.allocate(capacity);
        buf.limit(0);
        return buf;
    }
41657
protected WsByteBufferImpl allocateBufferDirect(WsByteBufferImpl buffer,
                                                    int size, boolean overrideRefCount) {
        DirectByteBufferHelper directByteBufferHelper = this.directByteBufferHelper.get();
        ByteBuffer byteBuffer;
        if (directByteBufferHelper != null) {
            byteBuffer = directByteBufferHelper.allocateDirectByteBuffer(size);
        } else {
            byteBuffer = ByteBuffer.allocateDirect(size);
        }
        buffer.setByteBufferNonSafe(byteBuffer);
        return buffer;
    }
693208
private void ensureCapacity(int requestedCapacity) {

        if (requestedCapacity > getCapacity()) {
            int newCapacity = getCapacity();
            while (requestedCapacity > newCapacity) {
                newCapacity = (newCapacity * 3) / 2;
            }
            reallocateBuffer(newCapacity);
        }
    }
598340
def allocate(self, handles, initial=False, params={}):
        """"""
        assert all(re.search('^\d+$', h) for h in handles), "All handles must be numbers: {}".format(handles)
        self.requests.put(('allocate', (handles, initial, params)))
198526
@SuppressWarnings("unchecked")
    private void ensureCapacity(int capacity) {
        checkCapacity(capacity);
        Elem<V>[] newArray = (Elem<V>[]) Array.newInstance(Elem.class, capacity + 2);
        if (newArray.length >= array.length) {
            System.arraycopy(array, 0, newArray, 0, array.length);
            for (int i = array.length; i < newArray.length; i++) {
                newArray[i] = new Elem<V>(SUP_KEY, null);
            }
        } else {
            System.arraycopy(array, 0, newArray, 0, newArray.length);
        }
        array = newArray;
    }
120233
def allocate_new_object_number

            last_object = self.each_object(compressed: true).max_by {|object| object.no }
            if last_object.nil?
                no = 1
            else
                no = last_object.no + 1
            end

            [ no, 0 ]
        end
1332742
async function() {
    const oThis = this
    ;

    await new openSTStorage.TokenBalanceModel({
      ddb_service: ddbServiceObj,
      auto_scaling: autoScalingServiceObj,
      erc20_contract_address: oThis.erc20
    }).allocate();
  }
376347
@Override
    public synchronized CommsServerByteBuffer allocate() {
        if (tc.isEntryEnabled())
            SibTr.entry(this, tc, "allocate");

        CommsServerByteBuffer buff = (CommsServerByteBuffer) super.allocate();

        if (tc.isEntryEnabled())
            SibTr.exit(this, tc, "allocate", buff);
        return buff;
    }
906806
CommitLogSegment allocatingFrom()
    {
        CommitLogSegment r = allocatingFrom;
        if (r == null)
        {
            advanceAllocatingFrom(null);
            r = allocatingFrom;
        }
        return r;
    }
1144732
@Override
  protected void reserveInternal(int newCapacity) {
    int oldCapacity = (nulls == 0L) ? 0 : capacity;
    if (isArray() || type instanceof MapType) {
      this.lengthData =
          Platform.reallocateMemory(lengthData, oldCapacity * 4L, newCapacity * 4L);
      this.offsetData =
          Platform.reallocateMemory(offsetData, oldCapacity * 4L, newCapacity * 4L);
    } else if (type instanceof ByteType || type instanceof BooleanType) {
      this.data = Platform.reallocateMemory(data, oldCapacity, newCapacity);
    } else if (type instanceof ShortType) {
      this.data = Platform.reallocateMemory(data, oldCapacity * 2L, newCapacity * 2L);
    } else if (type instanceof IntegerType || type instanceof FloatType ||
        type instanceof DateType || DecimalType.is32BitDecimalType(type)) {
      this.data = Platform.reallocateMemory(data, oldCapacity * 4L, newCapacity * 4L);
    } else if (type instanceof LongType || type instanceof DoubleType ||
        DecimalType.is64BitDecimalType(type) || type instanceof TimestampType) {
      this.data = Platform.reallocateMemory(data, oldCapacity * 8L, newCapacity * 8L);
    } else if (childColumns != null) {
      // Nothing to store.
    } else {
      throw new RuntimeException("Unhandled " + type);
    }
    this.nulls = Platform.reallocateMemory(nulls, oldCapacity, newCapacity);
    Platform.setMemory(nulls + oldCapacity, (byte)0, newCapacity - oldCapacity);
    capacity = newCapacity;
  }