Class RamUsageTester


  • public final class RamUsageTester
    extends Object
    Crawls object graph to collect RAM usage for testing
    • Constructor Detail

      • RamUsageTester

        public RamUsageTester()
    • Method Detail

      • ramUsed

        public static long ramUsed​(Object obj,
                                   RamUsageTester.Accumulator accumulator)
        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

        public static long ramUsed​(Object obj)
        Same as calling sizeOf(obj, DEFAULT_FILTER).