Increase heap size in java for weka

后端 未结 17 1312
天命终不由人
天命终不由人 2020-12-14 08:27

I\'m trying to increase the heap size in java for weka which keeps crashing. I used the suggested line:

> java -Xmx500m -classpath

but

相关标签:
17条回答
  • 2020-12-14 09:08

    If you're using Weka 3.8.1 on Windows you can save yourself a lot of trouble by editing the javaOpts parameter. The parameter maxheap isn't used anymore, so you can set javaOpts like this in RunWeka.ini file:

    javaOpts= -Xmx1040m
    

    Where 1040m is the amount of memory you want to allocate.

    Mind that the file is case sensitive.

    There are a lot of ways to set this up, but this is the faster way to get Weka runing on a Windows environment at this version.

    Edit: If you want Weka to use more than 1gb on windows, you need to have JDK installed. Regular JRE wont do it.

    0 讨论(0)
  • 2020-12-14 09:08

    If we are using Weka Workbench CLI or Knowledge explorer we need to change as below.

    As the documentation suggests the runtime parameter should be -Xmx[size_required]m where [size_required] is memory size you intend to keep to avoid memory exception.

    Open RunWeka.ini

    Define maxheap=[size_required]G

    In my case I kept maxheap=4G , One can set like maxheap=4096m and add -Xmx#maxheap# to all the run options at # setups (prefixed with "cmd_") sections next to java commands like below

    cmd_default=javaw -Xmx#maxheap# ...............
    cmd_console=cmd.exe /K start cmd.exe ..................
    cmd_explorer=java -Xmx#maxheap# .................
    cmd_knowledgeFlow=java -Xmx#maxheap#....................
    
    maxheap=4G
    

    Verify the same by restarting Weka and Help>>SystemInfo

    0 讨论(0)
  • 2020-12-14 09:09

    What I found was the actual issue was in the file 'RunWeka.ini' in '\Program Files (x86)\Weka-3-6'. I opened it with notepad and in the middle of the file there is a line 'maxheap = 512m'.

    I changed the line to read 'maxheap=2000m', saved the file and reloaded weka and this fixed my problems.

    I'm not sure if this is the correct way to do it or not but it worked for me.

    0 讨论(0)
  • 2020-12-14 09:12

    The official Weka answer is right..But....crucial is to first get rid of all JVM files and install the relevant 32 or 64 bit Java version. Not using the relevant version causes many problems including the impossibility to increase the heap further than 1024m (by changing the ini file).

    0 讨论(0)
  • 2020-12-14 09:14

    If you run weka from the command line but not through java i.e. typing weka into the command line, instead of typing

    weka
    

    specify the memory flag

    weka -m 1024m
    

    This will specify 1024 megabytes.

    0 讨论(0)
  • 2020-12-14 09:18

    If you're running weka via weka.sh, you can directly run it with memory option. For example,

    sh weka.sh -memory 10g
    

    This will increase the heap size to 10Gb (tested using Weka 3.8.4 on Ubuntu 18.04)

    0 讨论(0)
提交回复
热议问题