/** * Measures the size in memory (heap) of the objects passed in, walking their graph down * Any overlap of the graphs being passed in will be recognized and only measured once * * @param maxDepth maximum depth of the object graph to traverse * @param abortWhenMaxDepthExceeded true if the object traversal should be aborted when the max depth is exceeded * @param obj the root objects of the graphs to measure * @return the total size in bytes for these objects * @see #sizeOf(Object) */ public Size deepSizeOf(int maxDepth, boolean abortWhenMaxDepthExceeded, Object... obj) { return new Size(walker.walk(maxDepth, abortWhenMaxDepthExceeded, obj), true); }
/** * Measures the size in memory (heap) of the objects passed in, walking their graph down * Any overlap of the graphs being passed in will be recognized and only measured once * * @param maxDepth maximum depth of the object graph to traverse * @param abortWhenMaxDepthExceeded true if the object traversal should be aborted when the max depth is exceeded * @param obj the root objects of the graphs to measure * @return the total size in bytes for these objects * @see #sizeOf(Object) */ public Size deepSizeOf(int maxDepth, boolean abortWhenMaxDepthExceeded, Object... obj) { return new Size(walker.walk(maxDepth, abortWhenMaxDepthExceeded, obj), true); }
/** * Measures the size in memory (heap) of the objects passed in, walking their graph down * Any overlap of the graphs being passed in will be recognized and only measured once * * @param maxDepth maximum depth of the object graph to traverse * @param abortWhenMaxDepthExceeded true if the object traversal should be aborted when the max depth is exceeded * @param obj the root objects of the graphs to measure * @return the total size in bytes for these objects * @see #sizeOf(Object) */ public Size deepSizeOf(int maxDepth, boolean abortWhenMaxDepthExceeded, Object... obj) { return new Size(walker.walk(maxDepth, abortWhenMaxDepthExceeded, obj), true); }
/** * Measures the size in memory (heap) of the objects passed in, walking their graph down * Any overlap of the graphs being passed in will be recognized and only measured once * * @param maxDepth maximum depth of the object graph to traverse * @param abortWhenMaxDepthExceeded true if the object traversal should be aborted when the max depth is exceeded * @param obj the root objects of the graphs to measure * @return the total size in bytes for these objects * @see #sizeOf(Object) */ public Size deepSizeOf(int maxDepth, boolean abortWhenMaxDepthExceeded, Object... obj) { try { return new Size(walker.walk(maxDepth, abortWhenMaxDepthExceeded, obj), true); } catch (MaxDepthExceededException e) { LOG.warn(e.getMessage()); return new Size(e.getMeasuredSize(), false); } }