public class Memory extends Object implements RevisionHandler
setEnabled(boolean)
Modifier and Type | Field and Description |
---|---|
protected static boolean |
m_Enabled
whether memory management is enabled
|
protected static long |
m_Initial
the initial size of the JVM
|
protected long |
m_Max
the maximum amount of memory that can be used
|
protected Runtime |
m_Runtime
the current runtime variable
|
protected long |
m_Total
the total memory that is used
|
protected boolean |
m_UseGUI
whether a GUI is present
|
Constructor and Description |
---|
Memory()
initializes the memory management without GUI support
|
Memory(boolean useGUI)
initializes the memory management
|
Modifier and Type | Method and Description |
---|---|
long |
getCurrent()
returns the current memory consumption
|
long |
getInitial()
returns the initial size of the JVM
|
long |
getMax()
returns the maximum amount of memory that can be assigned
|
String |
getRevision()
Returns the revision string.
|
boolean |
getUseGUI()
whether to display a dialog in case of a problem (= TRUE) or just print
on stderr (= FALSE)
|
boolean |
isEnabled()
returns whether the memory management is enabled
|
boolean |
isOutOfMemory()
checks if there's still enough memory left.
|
static void |
main(String[] args)
prints only some statistics
|
void |
setEnabled(boolean value)
sets whether the memory management is enabled
|
void |
showOutOfMemory()
prints an error message if OutOfMemory (and if GUI is present a dialog),
otherwise nothing happens.
|
void |
stopThreads()
stops all the current threads, to make a restart possible
|
static double |
toMegaByte(long bytes)
returns the amount of bytes as MB
|
protected static boolean m_Enabled
protected boolean m_UseGUI
protected static long m_Initial
protected long m_Total
protected long m_Max
protected Runtime m_Runtime
public Memory()
public Memory(boolean useGUI)
useGUI
- whether a GUI is presentpublic boolean isEnabled()
public void setEnabled(boolean value)
value
- true if the management should be enabledpublic boolean getUseGUI()
public long getInitial()
public long getCurrent()
public long getMax()
public boolean isOutOfMemory()
public static double toMegaByte(long bytes)
public void showOutOfMemory()
isOutOfMemory()
,
m_Enabled
public void stopThreads()
public String getRevision()
getRevision
in interface RevisionHandler
public static void main(String[] args)
args
- the commandline arguments - ignoredCopyright © 2015 University of Waikato, Hamilton, NZ. All rights reserved.