程序包 weka.core
类 Memory
java.lang.Object
weka.core.Memory
- 所有已实现的接口:
RevisionHandler
A little helper class for Memory management. The memory management can be
disabled by using the setEnabled(boolean) method.
- 版本:
- $Revision: 9487 $
- 作者:
- FracPete (fracpete at waikato dot ac dot nz)
- 另请参阅:
-
字段概要
字段修饰符和类型字段说明static final long
static final long
static final long
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明long
returns the currently used size of the JVM heap, obtains a fresh MemoryUsage object to do so.long
returns the initial size of the JVM heap, obtains a fresh MemoryUsage object to do so.long
getMax()
returns the maximum size of the JVM heap, obtains a fresh MemoryUsage object to do so.Returns the revision string.boolean
whether to display a dialog in case of a problem (= TRUE) or just print on stderr (= FALSE)boolean
returns whether the memory management is enabledboolean
checks if there's still enough memory left by checking whether there is still a 50MB margin between getUsed() and getMax().static void
prints only some statisticsboolean
Checks to see if memory is running low.void
setEnabled
(boolean value) sets whether the memory management is enabledboolean
Prints a warning message if memoryIsLow (and if GUI is present a dialog).void
prints an error message if OutOfMemory (and if GUI is present a dialog), otherwise nothing happens.void
stops all the current threads, to make a restart possiblestatic double
toMegaByte
(long bytes) returns the amount of bytes as MB
-
字段详细资料
-
构造器详细资料
-
Memory
public Memory()initializes the memory management without GUI support -
Memory
public Memory(boolean useGUI) initializes the memory management- 参数:
useGUI
- whether a GUI is present
-
-
方法详细资料
-
isEnabled
public boolean isEnabled()returns whether the memory management is enabled- 返回:
- true if enabled
-
setEnabled
public void setEnabled(boolean value) sets whether the memory management is enabled- 参数:
value
- true if the management should be enabled
-
getUseGUI
public boolean getUseGUI()whether to display a dialog in case of a problem (= TRUE) or just print on stderr (= FALSE)- 返回:
- true if the GUI is used
-
getInitial
public long getInitial()returns the initial size of the JVM heap, obtains a fresh MemoryUsage object to do so.- 返回:
- the initial size in bytes
-
getCurrent
public long getCurrent()returns the currently used size of the JVM heap, obtains a fresh MemoryUsage object to do so.- 返回:
- the used size in bytes
-
getMax
public long getMax()returns the maximum size of the JVM heap, obtains a fresh MemoryUsage object to do so.- 返回:
- the maximum size in bytes
-
isOutOfMemory
public boolean isOutOfMemory()checks if there's still enough memory left by checking whether there is still a 50MB margin between getUsed() and getMax(). if ENABLED is true, then false is returned always. updates the MemoryUsage variable before checking.- 返回:
- true if out of memory (only if management enabled, otherwise always false)
-
memoryIsLow
public boolean memoryIsLow()Checks to see if memory is running low. Low is defined as available memory less than 20% of max memory.- 返回:
- true if memory is running low
-
toMegaByte
public static double toMegaByte(long bytes) returns the amount of bytes as MB- 返回:
- the MB amount
-
showOutOfMemory
public void showOutOfMemory()prints an error message if OutOfMemory (and if GUI is present a dialog), otherwise nothing happens. isOutOfMemory() has to be called beforehand, since it sets all the memory parameters.- 另请参阅:
-
isOutOfMemory()
m_Enabled
-
showMemoryIsLow
public boolean showMemoryIsLow()Prints a warning message if memoryIsLow (and if GUI is present a dialog).- 返回:
- true if user opts to continue, disabled or GUI is not present.
-
stopThreads
public void stopThreads()stops all the current threads, to make a restart possible -
getRevision
Returns the revision string.- 指定者:
getRevision
在接口中RevisionHandler
- 返回:
- the revision
-
main
prints only some statistics- 参数:
args
- the commandline arguments - ignored
-