code: public LongArray allocateArray(long size) {
      long required = size * 8L;
      MemoryBlock page = taskMemoryManager.allocatePage(required, this);
      if (page == null || page.size() < required) {
        throwOom(page, required);
      }
      used += required;
      return new LongArray(page);
    }
docs: Allocates a LongArray of `size`. Note that this method may throw `SparkOutOfMemoryError`
  if Spark doesn't have enough memory for this allocation, or throw `TooLargePageException`
  if this `LongArray` is too large to fit in a single page. The caller side should take care of
  these two exceptions, or make sure the `size` is small enough that won't trigger exceptions.
  
  @throws SparkOutOfMemoryError
  @throws TooLargePageException