Package adams.core
Class Memory
- java.lang.Object
-
- adams.core.Memory
-
public class Memory extends Object
A little helper class for Memory management. Very crude, since JDK 1.4 doesn't offer real Memory Management.
The memory management can be disabled by using the setEnabled(boolean) method.- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
setEnabled(boolean)
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_Enabled
whether memory management is enabled.protected long
m_Max
the maximum amount of memory that can be used.protected Runtime
m_Runtime
the current runtime variable.protected static Memory
m_Singleton
the singleton.protected long
m_Total
the total memory that is used.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getCurrent()
returns the current memory consumption.long
getMax()
returns the maximum amount of memory that can be assigned.static Memory
getSingleton()
Returns the singleton.boolean
isEnabled()
returns whether the memory management is enabled.void
setEnabled(boolean value)
sets whether the memory management is enabled.
-
-
-
Field Detail
-
m_Enabled
protected boolean m_Enabled
whether memory management is enabled.
-
m_Total
protected long m_Total
the total memory that is used.
-
m_Max
protected long m_Max
the maximum amount of memory that can be used.
-
m_Runtime
protected Runtime m_Runtime
the current runtime variable.
-
m_Singleton
protected static Memory m_Singleton
the singleton.
-
-
Method Detail
-
isEnabled
public boolean isEnabled()
returns whether the memory management is enabled.- Returns:
- true if enabled
-
setEnabled
public void setEnabled(boolean value)
sets whether the memory management is enabled.- Parameters:
value
- true if the management should be enabled
-
getCurrent
public long getCurrent()
returns the current memory consumption.- Returns:
- the current size in bytes
-
getMax
public long getMax()
returns the maximum amount of memory that can be assigned.- Returns:
- the maximum size in bytes
-
getSingleton
public static Memory getSingleton()
Returns the singleton.- Returns:
- the singleton
-
-