public static final class MemoryMeter.Builder extends Object
MemoryMeter instances| Modifier and Type | Method and Description |
|---|---|
MemoryMeter |
build() |
MemoryMeter.Builder |
ignoreOuterClassReference()
Ignores the outer class reference from non-static inner classes.
|
MemoryMeter.Builder |
measureKnownSingletons()
Measures the space occupied by known singletons such as
Class objects, enums, ClassLoaders and
AccessControlContexts. |
MemoryMeter.Builder |
measureNonStrongReferences()
Measures the references from a
Reference (like weak/soft/phantom references). |
MemoryMeter.Builder |
printVisitedTree()
Prints the classes tree to
System.out when measuring through measureDeep. |
MemoryMeter.Builder |
printVisitedTreeUpTo(int depth)
Prints the classes tree to
System.out up to the specified depth when measuring through measureDeep. |
MemoryMeter.Builder |
withGuessing(MemoryMeter.Guess strategy,
MemoryMeter.Guess... fallbacks)
Specify what should be the strategy used to measure the shallow size of object.
|
public MemoryMeter build()
public MemoryMeter.Builder withGuessing(MemoryMeter.Guess strategy, MemoryMeter.Guess... fallbacks)
strategy - the strategy that should be used to measure objectsfallbacks - the fallback strategiespublic MemoryMeter.Builder ignoreOuterClassReference()
In practice this is only useful if the top class provided to MemoryMeter.measureDeep is an inner
class and we wish to ignore the outer class in the measurement.
public MemoryMeter.Builder measureKnownSingletons()
Class objects, enums, ClassLoaders and
AccessControlContexts. By default MemoryMeter will ignore those.public MemoryMeter.Builder measureNonStrongReferences()
Reference (like weak/soft/phantom references).
By default MemoryMeter will ignore those.public MemoryMeter.Builder printVisitedTree()
System.out when measuring through measureDeep.public MemoryMeter.Builder printVisitedTreeUpTo(int depth)
System.out up to the specified depth when measuring through measureDeep.depth - the depth up to which the class tree must be printedCopyright © 2023. All rights reserved.