private static void validateCapacity(long capacity) {
    if (Long.bitCount(capacity) != 1) {
      throw new AssertionError("Capacity must be a power of two but got " + capacity);
    }
    if (capacity <= 0) {
      throw new AssertionError("Invalid capacity " + capacity);
    }
    if (capacity > Integer.MAX_VALUE) {
      throw new RuntimeException("Attempting to expand the hash table to " + capacity
          + " that overflows maximum array size. For this query, you may want to disable "
          + ConfVars.HIVE_DYNAMIC_PARTITION_HASHJOIN.varname + " or reduce "
          + ConfVars.HIVE_CONVERT_JOIN_NOCONDITIONAL_TASK_THRESHOLD.varname);
    }
  }
Number of bytes used by the hashmap.
There are two main components that take most memory: writeBuffers and refs
Others include instance fields: 100
@return number of bytes
ql/src/java/org/apache/hadoop/hive/ql/exec/persistence/BytesBytesMultiHashMap.java