Increase the Memory Limit in Weka
Weka uses the memory settings passed to it from the Java command line or the script that invokes it. If you're experiencing an OutOfMemory exception, you must increase the amount of heap space available to Weka by changing the Java options that set memory allocation. Follow the directions below to accomplish this.
In the examples below, the memory size notations are m for megabytes and g for gigabytes. You can use whichever is most appropriate for your situation.
Exit Weka if it is currently running.
- If you are running Weka standalone from the command line, modify your Java command to include an -Xmx line that specifies a large upper memory limit.
java -Xmx2g weka.jar
- If you are running Weka as part of a script, change your Java invocation so that it includes the above -Xmx setting.
- Start Weka and ensure that there are no memory-related exceptions.
The Java virtual machine instance that Weka uses now has access to more heap space, which should solve OutOfMemory exceptions and increase performance.