All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.marschall.objectsize.InstanceHolder Maven / Gradle / Ivy

The newest version!
package com.github.marschall.objectsize;

final class InstanceHolder {

  static final ObjectSizeCalculator INSTANCE = getInstance();

  private static ObjectSizeCalculator getInstance() {
    try {
      if (!JvmtiObjectSizeCalculator.isSupported()) {
        return new UnsupportedObjectSizeCalculator();
      }
    } catch (LinkageError e) {
      return new UnsupportedObjectSizeCalculator();
    }
    ObjectSizeCalculator calculator = new JvmtiObjectSizeCalculator();
    if (JfrObjectSizeCalculator.isSupported()) {
      calculator = new JfrObjectSizeCalculator(calculator);
    }
    return calculator;
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy