public static enum MemoryMeter.Guess extends Enum<MemoryMeter.Guess>
MemoryMeter instance to measure the shallow size of an object.| Enum Constant and Description |
|---|
INSTRUMENTATION
Relies on
java.lang.instrument.Instrumentation to measure shallow object size. |
INSTRUMENTATION_AND_SPECIFICATION
Relies on
java.lang.instrument.Instrumentation to measure non array object and the Specification approach to measure arrays. |
SPECIFICATION
Computes the shallow size of objects using VM information.
|
UNSAFE
Relies on
Unsafe to measure shallow object size. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canBeUsedAsFallbackFrom(MemoryMeter.Guess guess) |
static void |
checkOrder(List<MemoryMeter.Guess> guesses) |
boolean |
requireInstrumentation()
Checks if this strategy requires
Instrumentation to be present. |
boolean |
requireUnsafe()
Checks if this strategy requires
Unsafe to be present. |
static MemoryMeter.Guess |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static MemoryMeter.Guess[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final MemoryMeter.Guess INSTRUMENTATION
java.lang.instrument.Instrumentation to measure shallow object size.
It requires Instrumentation to be available, but it is the most accurate strategy.public static final MemoryMeter.Guess INSTRUMENTATION_AND_SPECIFICATION
java.lang.instrument.Instrumentation to measure non array object and the Specification approach to measure arrays.
This strategy tries to combine the best of both strategies the accuracy and speed of Instrumentation for non array object
and the speed of Specification for measuring array objects for which all strategy are accurate. For some reason Instrumentation is slower for arrays before Java 17.public static final MemoryMeter.Guess UNSAFE
Unsafe to measure shallow object size.
It requires Unsafe to be available. After INSTRUMENTATION based strategy UNSAFE is the most accurate strategy.public static final MemoryMeter.Guess SPECIFICATION
public static MemoryMeter.Guess[] values()
for (MemoryMeter.Guess c : MemoryMeter.Guess.values()) System.out.println(c);
public static MemoryMeter.Guess valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic boolean requireInstrumentation()
Instrumentation to be present.true if this strategy requires Instrumentation to be present, false otherwise.public boolean requireUnsafe()
Unsafe to be present.true if this strategy requires Unsafe to be present, false otherwise.public boolean canBeUsedAsFallbackFrom(MemoryMeter.Guess guess)
public static void checkOrder(List<MemoryMeter.Guess> guesses)
Copyright © 2023. All rights reserved.