public class MemoryControl
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static java.util.concurrent.atomic.AtomicBoolean |
shortStatus |
private static boolean |
simulatedShortStatus |
private static MemoryStrategy |
strategy |
private static boolean |
usingStandardStrategy |
Constructor and Description |
---|
MemoryControl() |
Modifier and Type | Method and Description |
---|---|
static long |
available()
memory that is available including increasing total memory up to maximum
|
static long |
free()
memory that is free without increasing of total memory taken from os
|
static boolean |
gc(int last,
java.lang.String info)
Runs the garbage collector if last garbage collection is more than last millis ago
|
static boolean |
getSimulatedShortStatus()
the simulated short status can be retrieved to show that option in online interfaces
|
private static MemoryStrategy |
getStrategy() |
static java.lang.String |
getStrategyName() |
static void |
main(java.lang.String[] args)
main
|
static long |
maxMemory()
maximum memory the Java virtual will allocate machine; may vary over time in some cases
|
static boolean |
properState() |
static boolean |
request(long size,
boolean force)
check for a specified amount of bytes
|
static void |
resetProperState()
forced enable properState - StandardMemoryStrategy only
|
static void |
setProperMbyte(long mbyte)
set the memory to be available for properState - StandardMemoryStrategy only
|
static void |
setSimulatedShortStatus(boolean status)
the simulated short status can be set to find out if the short status has effects to the system
|
static void |
setStandardStrategy(boolean std) |
static boolean |
shortStatus() |
static long |
total()
currently allocated memory in the Java virtual machine; may vary over time
|
static long |
used()
memory that is currently bound in objects
|
private static java.util.concurrent.atomic.AtomicBoolean shortStatus
private static boolean simulatedShortStatus
private static boolean usingStandardStrategy
private static MemoryStrategy strategy
private static MemoryStrategy getStrategy()
public static final void setStandardStrategy(boolean std)
public static final java.lang.String getStrategyName()
public static final boolean gc(int last, java.lang.String info)
last
- time which must be passed since lased gcinfo
- additional info for logpublic static final long free()
public static final long available()
public static final long maxMemory()
public static final long total()
public static boolean request(long size, boolean force)
size
- the requested amount of free memory in bytesforce
- specifies whether risk an expensive GCpublic static void setSimulatedShortStatus(boolean status)
status
- public static boolean getSimulatedShortStatus()
public static boolean shortStatus()
public static long used()
public static boolean properState()
public static void resetProperState()
public static void setProperMbyte(long mbyte)
public static void main(java.lang.String[] args)
args
- use 'force' to request by force, use 'std' / 'gen' to specify strategy