public long lengthForPrimitiveArrayOfSize(int primitiveSize, long length) {
    return alignUp(array() + primitiveSize*length, memoryAlign());
  }
Estimation of memory footprint of object
storage-api/src/java/org/apache/hadoop/hive/ql/util/JavaDataModel.java