Class HeapUsageEstimator

java.lang.Object
com.gigaspaces.internal.jvm.HeapUsageEstimator

public class HeapUsageEstimator extends Object
Based on Java memory spec, and specifically https://github.com/jbellis/jamm/blob/master/src/org/github/jamm/MemoryLayoutSpecification.java
Since:
15.5
Author:
Niv Ingberg
  • Constructor Details

    • HeapUsageEstimator

      public HeapUsageEstimator()
  • Method Details

    • getDesc

      public String getDesc()
    • getObjectHeaderSize

      public int getObjectHeaderSize()
    • getObjectPadding

      public int getObjectPadding()
    • getSuperclassFieldPadding

      public int getSuperclassFieldPadding()
    • getReferenceSize

      public int getReferenceSize()
    • sizeOf

      public long sizeOf(Object obj)
      Returns:
      The size of the provided instance as defined by the detected MemoryLayoutSpecification. For an array this is dependent on the size of the array, but for an object this is fixed for all instances
    • sizeOfField

      public int sizeOfField(Class<?> type)
      Returns:
      The memory size of a field of a class of the provided type; for Objects this is the size of the reference only
    • sizeOfInstance

      public long sizeOfInstance(Class<?> type)
    • sizeOfArray

      public long sizeOfArray(Class<?> type, int length)
    • roundTo

      public static long roundTo(long x, int multiple)
    • main

      public static void main(String[] args)