Package ucar.unidata.idv
Class SystemMemoryManager
java.lang.Object
ucar.unidata.idv.SystemMemoryManager
Global to deal with IDV command line memory settings.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longMaximum memory for the IDV.static final longMinimum memory for the IDV. -
Method Summary
Modifier and TypeMethodDescriptionstatic longcheckAndRepair(long memory) Check and repair memory settingsstatic longconvertToNumber(int percent) Convenience method.static floatconvertToPercent(long memory) Convenience method.static longThe 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 longFor 32 bit OS, the total should be the minimum of the (total system memory - 512Mb) and 1536MB.static booleanChecks if is memory is available for this JVM.
-
Field Details
-
MINIMUM_MEMORY
public static final long MINIMUM_MEMORYMinimum memory for the IDV.- See Also:
-
MAXIMUM_MEMORY
public static final long MAXIMUM_MEMORYMaximum 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 callisMemoryAvailable()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).
-