Class SystemMemoryManager

java.lang.Object
ucar.unidata.idv.SystemMemoryManager

public class SystemMemoryManager extends Object
Global to deal with IDV command line memory settings.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final long
    Maximum memory for the IDV.
    static final long
    Minimum memory for the IDV.
  • Method Summary

    Modifier and Type
    Method
    Description
    static long
    checkAndRepair(long memory)
    Check and repair memory settings
    static long
    convertToNumber(int percent)
    Convenience method.
    static float
    convertToPercent(long memory)
    Convenience method.
    static long
    The default when the user first starts up should be to use 80% between the "low and high-water mark", but they should be allowed to increase that to 100% of the high-water mark.
    static long
    For 32 bit OS, the total should be the minimum of the (total system memory - 512Mb) and 1536MB.
    static boolean
    Checks if is memory is available for this JVM.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • MINIMUM_MEMORY

      public static final long MINIMUM_MEMORY
      Minimum memory for the IDV.
      See Also:
    • MAXIMUM_MEMORY

      public static final long MAXIMUM_MEMORY
      Maximum memory for the IDV. This is a soft limit. Users can still shoot themselves in the foot by manually adjusting higher via the edit preferences menu.
      See Also:
  • Method Details

    • isMemoryAvailable

      public static boolean isMemoryAvailable()
      Checks if is memory is available for this JVM.
      Returns:
      true, if memory is available
    • getTotalMemory

      public static long getTotalMemory()
      For 32 bit OS, the total should be the minimum of the (total system memory - 512Mb) and 1536MB. On 64-bit systems, it should be the total system memory-512Mb. If the total system memory is not available -1. Probably should call isMemoryAvailable() first. Must return at least 512.
      Returns:
      Return the total memory in megabytes, if available.
    • getDefaultMemory

      public static long getDefaultMemory()
      The default when the user first starts up should be to use 80% between the "low and high-water mark", but they should be allowed to increase that to 100% of the high-water mark. There are a couple of exceptions to the 80% heuristic. The amount of memory returned will never be invalid input: '<' 512GB, and never > 3GB. Also, if on 32 bit OS be conservative and choose 70%. For example, if we have 32 bit windows with 1536 of memory, the result will be 1229.
      Returns:
      the default memory
    • convertToPercent

      public static float convertToPercent(long memory)
      Convenience method. Convert memory to percent.
      Parameters:
      memory - the memory
      Returns:
      the percent or -1
    • convertToNumber

      public static long convertToNumber(int percent)
      Convenience method. Convert memory percent to number.
      Parameters:
      percent - the percent
      Returns:
      the number or -1
    • checkAndRepair

      public static long checkAndRepair(long memory)
      Check and repair memory settings
      Parameters:
      memory - the memory setting
      Returns:
      the memory (fixed if necessary).