@Override
    protected int estimate(Object obj, HashMap<Class<?>, ObjectEstimator> parent,
        IdentityHashMap<Object, Boolean> uniqueObjects) {
      if (obj instanceof Collection<?>) {
        Collection<?> c = (Collection<?>) obj;
        int overhead = estimateOverhead(c.size()),
            elements = estimateCollectionElements(parent, c, null, uniqueObjects);
        return overhead + elements + memoryModel.object();
      } else if (obj instanceof Map<?, ?>) {
        Map<?, ?> m = (Map<?, ?>) obj;
        int overhead = estimateOverhead(m.size()),
            elements = estimateMapElements(parent, m, null, uniqueObjects);
        return overhead + elements + memoryModel.object();
      }
      throw new AssertionError(obj.getClass().getName());
    }
Creates size estimators for java objects. The estimators attempt to do most of the reflection
work at initialization time, and also take some shortcuts, to minimize the amount of work done
during the actual estimation.
TODO: clean up
storage-api/src/java/org/apache/hadoop/hive/ql/util/IncrementalObjectSizeEstimator.java