public static long sizedelta ( final Object base , final Object obj ) { if ( null == obj || isSharedFlyweight ( obj ) ) { return 0 ; } if ( null == base ) { throw new IllegalArgumentException ( "null input: base" ) ; } final IdentityHashMap visited = new IdentityHashMap ( 40000 ) ; try { computeSizeof ( base , visited , CLASS_METADATA_CACHE ) ; return visited . containsKey ( obj ) ? 0 : computeSizeof ( obj , visited , CLASS_METADATA_CACHE ) ; } catch ( RuntimeException re ) { // re.printStackTrace();//DEBUG return - 1 ; } catch ( NoClassDefFoundError ncdfe ) { // BUG: throws "java.lang.NoClassDefFoundError: org.eclipse.core.resources.IWorkspaceRoot" when run in WSAD // 5 // see // http://www.javaworld.com/javaforums/showflat.php?Cat=&Board=958763&Number=15235&page=0&view=collapsed&sb=5&o= // System.err.println(ncdfe);//DEBUG return - 1 ; } }
Estimates the full size of the object graph rooted at obj by pre - populating the visited set with the object graph rooted at base . The net effect is to compute the size of obj by summing over all instance data contained in obj but not in base .