< prev index next > src/java.base/share/classes/java/util/Objects.java
Print this page
package java.util;
import jdk.internal.util.Preconditions;
import jdk.internal.vm.annotation.ForceInline;
+ import jdk.internal.misc.Unsafe;
import java.util.function.Supplier;
/**
* This class consists of {@code static} utility methods for operating
public static
int checkFromIndexSize(int fromIndex, int size, int length) {
return Preconditions.checkFromIndexSize(fromIndex, size, length, null);
}
+ /**
+ * Return the size of the object in the heap.
+ *
+ * @param o an object
+ * @return the objects's size
+ * @since Valhalla
+ */
+ public static long getObjectSize(Object o) {
+ return Unsafe.getUnsafe().getObjectSize(o);
+ }
}
< prev index next >