Package adams.core

Class 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 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