code: public static HeapMemory allocate(long size) {
      if (size > MAX_SIZE)
        throw new IllegalArgumentException("size cannot be greater than " + MAX_SIZE);
      return new HeapMemoryAllocator().allocate(size);
    }
docs: Allocates heap memory via {@link HeapMemoryAllocator}.
  
  @param size The count of the memory to allocate.
  @return The allocated memory.
  @throws IllegalArgumentException If {@code count} is greater than the maximum allowed count for
  an array on the Java heap - {@code Integer.MAX_VALUE - 5}