Skip to main content
Hitachi Vantara Lumada and Pentaho Documentation

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.

Note: 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.
  1. Exit Weka if it is currently running.
  2. 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
  3. If you are running Weka as part of a script, change your Java invocation so that it includes the above -Xmx setting.
  4. 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.