Package org.apache.lucene.tests.util
Class RamUsageTester
java.lang.Object
org.apache.lucene.tests.util.RamUsageTester
Crawls object graph to collect RAM usage for testing
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
An accumulator of object references. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
humanSizeOf
(Object object) Return a human-readable size of a given object.static long
Same as callingsizeOf(obj, DEFAULT_FILTER)
.static long
ramUsed
(Object obj, RamUsageTester.Accumulator accumulator) Estimates the RAM usage by the given object.
-
Constructor Details
-
RamUsageTester
public RamUsageTester()
-
-
Method Details
-
ramUsed
Estimates the RAM usage by the given object. It will walk the object tree and sum up all referenced objects.Resource Usage: This method internally uses a set of every object seen during traversals so it does allocate memory (it isn't side-effect free). After the method exits, this memory should be GCed.
-
ramUsed
Same as callingsizeOf(obj, DEFAULT_FILTER)
. -
humanSizeOf
Return a human-readable size of a given object.
-