Class MemUtils


  • public class MemUtils
    extends java.lang.Object
    A simple class to experiment with your JVM's garbage collector and memory sizes for various _data types.
    Author:
    Vladimir Roubtsov
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static double BYTES_PER_MB  
    • Constructor Summary

      Constructors 
      Constructor Description
      MemUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static long freeMemory()  
      static double mb​(long bytes)  
      static void printMemory​(java.lang.String msg, long mem)  
      static void printUsedMemory​(java.lang.String msg)  
      static void runGC()  
      static long totalMemory()  
      static long usedMemory()  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MemUtils

        public MemUtils()
    • Method Detail

      • runGC

        public static void runGC()
      • usedMemory

        public static long usedMemory()
      • freeMemory

        public static long freeMemory()
      • totalMemory

        public static long totalMemory()
      • mb

        public static double mb​(long bytes)
      • printUsedMemory

        public static void printUsedMemory​(java.lang.String msg)
      • printMemory

        public static void printMemory​(java.lang.String msg,
                                       long mem)