public class InstrumentationAndSpecStrategy extends MemoryLayoutBasedStrategy
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.MEMORY_LAYOUT| Constructor and Description |
|---|
InstrumentationAndSpecStrategy(Instrumentation instrumentation) |
| Modifier and Type | Method and Description |
|---|---|
long |
measureInstance(Object object,
Class<?> type)
Measures the shallow memory used by objects of the specified class.
|
arrayBaseOffset, computeArraySize, measure, measureArray, measureArray, measureArray, measureArray, measureArray, measureArray, measureArray, measureArray, measureArray, measureArray, measureField, supportComputeArraySizepublic InstrumentationAndSpecStrategy(Instrumentation instrumentation)
public long measureInstance(Object object, Class<?> type)
MemoryLayoutBasedStrategymeasureInstance in class MemoryLayoutBasedStrategyobject - the object to measuretype - the object typeCopyright © 2023. All rights reserved.