This method tries to mark memory as allocated. It allocates as much bytes as defined in <code>MEMORY_CHUNK</code>
and returns the number of bytes marked as allocated. This method doesn't really allocate memory.

@return the size of the allocated chunk
422163
public synchronized int allocateNextChunk() {
        if ((used_bytes.longValue() + (long) mem_chunksize) > max_allowed_bytes) {
            logger.info("No memory left");
            return 0;
        }
        used_bytes.set(used_bytes.longValue() + (long) mem_chunksize);
        return mem_chunksize;
    }
985716
public long getSize() {
        long elementSize = dumpClass.getHprof().getValueSize(getType());

        return dumpClass.classDumpSegment.getMinimumInstanceSize() + HPROF_ARRAY_OVERHEAD + (elementSize * getLength());
    }
915459
public int getNumOccupiedMemorySegments() {
		// either the number of memory segments, or one for spilling
		final int numPartitionBuffers = this.partitionBuffers != null ?
			this.partitionBuffers.length : this.buildSideWriteBuffer.getNumOccupiedMemorySegments();
		return numPartitionBuffers + numOverflowSegments;
	}
190088
@Override
	public int size() {

		if (allElementsInCache) {
			return orderedCache.size();
		} else {
			int count = 0;
			try (final RocksBytesIterator iterator = orderedBytesIterator()) {
				while (iterator.hasNext()) {
					iterator.next();
					++count;
				}
			}
			return count;
		}
	}
568085
public static ByteBuffer allocate(int capacity) {
        ByteBuffer buf = ByteBuffer.allocate(capacity);
        buf.limit(0);
        return buf;
    }
237659
public int getSize()
	{
		int retval = head.getTagSize() + head.getHeaderSize();

		if (head.getFooter())
		{
			retval += foot.getFooterSize();
		}

		return retval;
	}
1129976
public int getSize() {
        int ret = 0;
        MethodState state = firstPointer;
        while (state != null) {
            ret++;
            state = state.getNext();
        }
        return ret;
    }
387312
@Override
    public int getInMemoryDataSize()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "getInMemoryDataSize");

        JsMessage localMsg = getJSMessage(true);
        int msgSize = localMsg.getInMemorySize();

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "getInMemoryDataSize", Integer.valueOf(msgSize));

        return msgSize;
    }
1322050
def get_memory_size(self):
        """"""
        n = sys.getsizeof(self)
        n += sys.getsizeof(self.padding)
        n += total_size(self.start_addr)
        n += total_size(self._buf)
        n += sys.getsizeof(self._offset)
        return n
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();
    }
89990
public int numChars() {
    int len = 0;
    for (int i = 0; i < numBytes; i += numBytesForFirstByte(getByte(i))) {
      len += 1;
    }
    return len;
  }
960917
private Chunk chunkD() {
    if (H2O.SINGLE_PRECISION) {
      final byte[] bs = MemoryManager.malloc1(_len * 4, true);
      int j = 0;
      for (int i = 0; i < _len; ++i) {
        float f = 0;
        if (_id == null || _id.length == 0 || (j < _id.length && _id[j] == i)) {
          f = _ds != null ? (float)_ds[j] : (isNA2(j) || isEnum(j)) ? Float.NaN : (float)(_ls[j] * PrettyPrint.pow10(_xs[j]));
          ++j;
        }
        UDP.set4f(bs, 4 * i, f);
      }
      assert j == _sparseLen : "j = " + j + ", _sparseLen = " + _sparseLen;
      return new C4FChunk(bs);
    } else {
      final byte[] bs = MemoryManager.malloc1(_len * 8, true);
      int j = 0;
      for (int i = 0; i < _len; ++i) {
        double d = 0;
        if (_id == null || _id.length == 0 || (j < _id.length && _id[j] == i)) {
          d = _ds != null ? _ds[j] : (isNA2(j) || isEnum(j)) ? Double.NaN : _ls[j] * PrettyPrint.pow10(_xs[j]);
          ++j;
        }
        UDP.set8d(bs, 8 * i, d);
      }
      assert j == _sparseLen : "j = " + j + ", _sparseLen = " + _sparseLen;
      return new C8DChunk(bs);
    }
  }
628867
public int getSize() {
		int dataSize = size;

		for (int i = 0; i < getChildCount(); i++) {
			dataSize += ((ObjectGraphNode) getChildAt(i)).getSize();
		}

		return dataSize;
	}
1207260
public int getLengthInBytes() {
        long length = polygonOverheadInBytes();
        for (List<XYZPoint> loop : m_loops) {
            length += loopLengthInBytes(loop.size());
        }

        return (int)length;
    }
265547
private byte[] alloc() {
        position = 0;
        chunk++;
        
        if (chunk >= pool.size()) {
            byte[] bytes = new byte[chunk == 0 ? initialSize : incrementalSize];
            pool.add(bytes);
        }
        
        return chunk();
    }
821341
@Override
    public int smallByteSize() {
        int bound = byteSize();
        ByteBuffer buf = ByteBuffer.allocate(bound);
        asSmallBytes(buf);
        return buf.position();
    }
1128613
protected ByteBuffer getByteBuffer(int bufferLength) {
        if(_buffer == null) {
            _buffer = ByteBuffer.wrap(new byte[bufferLength]);
            _log.info("ByteBuffer allocated for buffering");
        }
        
        return _buffer;
    }