Releases a temporary buffer by returning to the cache or freeing it. If
returning to the cache then insert it at the start so that it is
likely to be returned by a subsequent call to getTemporaryDirectBuffer.
429405
static void offerFirstTemporaryDirectBuffer(ByteBuffer buf) {
        assert buf != null;
        BufferCache cache = bufferCache.get();
        if (!cache.offerFirst(buf)) {
            // cache is full
            free(buf);
        }
    }
556762
static void offerLastTemporaryDirectBuffer(ByteBuffer buf) {
        assert buf != null;
        BufferCache cache = bufferCache.get();
        if (!cache.offerLast(buf)) {
            // cache is full
            free(buf);
        }
    }
211682
def _release_command_buffer(self, command_buffer):
        """"""
        if command_buffer.closed:
            return

        self._cb_poll.unregister(command_buffer.host_id)
        self.connection_pool.release(command_buffer.connection)
        command_buffer.connection = None
258882
public void reset() {
        this.cacheHandler = null;
        this.pjp = null;
        this.cacheKey = null;
        this.cache = null;
        this.autoLoadTO = null;
        this.arguments = null;
        this.cacheWrapper = null;
    }
741179
private void copyToTargetBufferFrom(ByteBuffer source) {
		if (this.targetBuffer == null) {
			return;
		}

		int needed = source.remaining();
		int available = this.limit - this.position;
		int toCopy = Math.min(needed, available);

		this.targetBuffer.getMemorySegment().put(this.position, source, toCopy);

		this.position += toCopy;
	}
1103679
public void close()
  {
    if (_isFree)
      TempCharBuffer.freeAll(_head);

    _head = null;
    _buffer = null;
    _offset = 0;
    _length = 0;
  }
1027445
public void releaseMemory()
    {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "releaseMemory");

        synchronized (this)
        {

            // v is unused
            //ArrayList v = new ArrayList();

            // Create a new stream to replace old one
            // as set latest ls prefix
            oststream = new StateStream();
            oststream.init();
            oststream.setCompletedPrefix(oack);

        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "releaseMemory");
    }
1127601
public void freeCurrent() {
		int beforeReleaseNum = availableMemory.size();
		memManager.release(availableMemory);
		allocatedFloatingNum -= (beforeReleaseNum - availableMemory.size());
	}
565310
public static void releaseBuffer(Object message, RequestContext ctx) {
        final IdentityHashMap<Object, ByteBuf> buffers = ctx.attr(BUFFERS).get();
        checkState(buffers != null,
                   "Releasing buffer even though storeBuffer has not been called.");
        final ByteBuf removed = buffers.remove(message);
        if (removed == null) {
            throw new IllegalArgumentException("The provided message does not have a stored buffer.");
        }
        removed.release();
    }
791920
protected void reBuffer() {
        resetBuffer();

        try {
            if (bufferOffset >= fs.getFileStatus(inputPath).getLen()) // TODO: is this equivalent?
                return;

            input.seek(bufferOffset);

            int read = 0;

            while (read < buffer.length) {
                int n = input.read(buffer, read, buffer.length - read);
                if (n < 0)
                    break;
                read += n;
            }

            validBufferBytes = read;
            bytesSinceCacheFlush += read;
        } catch (IOException e) {
            throw new FSReadError(e, filePath);
        }
    }
782803
public static TempCharBuffer allocate()
  {
    TempCharBuffer next = _freeList.allocate();

    if (next == null)
      return new TempCharBuffer(SIZE);

    next._next = null;

    next._offset = 0;
    next._length = 0;
    next._bufferCount = 0;

    return next;
  }
818909
protected AbstractBuffer reset(long offset, long capacity, long maxCapacity) {
    this.offset = offset;
    this.capacity = 0;
    this.initialCapacity = capacity;
    this.maxCapacity = maxCapacity;
    capacity(initialCapacity);
    references.set(0);
    rewind();
    return this;
  }
599923
function(rawBuffer) {
    if (rawBuffer && this.offset === 0) return this.buffer;

    var out = new Buffer(8);
    this.buffer.copy(out, 0, this.offset, this.offset + 8);
    return out;
  }
1178462
private void returnAcceleration(Buffer buffer) {
        Callback<Acceleration> callback = getFirstCallback(BeanMessageID.CC_ACCEL_READ);
        if (callback != null) {
            callback.onResult(Acceleration.fromPayload(buffer));
        }
    }
913448
@Override
    protected boolean checkBuffer() throws IOException {
        if (null != this.buffer) {
            if (this.buffer.hasRemaining()) {
                return true;
            }
            this.buffer.release();
            this.buffer = null;
        }
        return setNextBuffer();
    }
842126
public void start()
  {
    _state = _state.toStart();
    
    _bufferCapacity = DEFAULT_SIZE;
    
    _tBuf = TempBuffer.create();
    
    _buffer = _tBuf.buffer();
    _startOffset = bufferStart();
    _offset = _startOffset;

    _contentLength = 0;
  }
478117
synchronized void release(CommsByteBuffer buff)
   {
      if (tc.isEntryEnabled()) SibTr.entry(this, tc, "release", buff);
      buff.reset();
      pool.add(buff);
      if (tc.isEntryEnabled()) SibTr.exit(this, tc, "release");
   }