是否有解决方法来解决"Java堆空间"问题?已经指定最大堆值时发生内存错误? [英] Is there a workaround to solve "Java heap space" memory error when the max heap value has been already specified?

查看:90
本文介绍了是否有解决方法来解决"Java堆空间"问题?已经指定最大堆值时发生内存错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在最新一代具有8GB RAM的Macbook Pro中运行WEKA分类器(J48,输入的.arff文件由3个字段组成,字段1具有〜27k个不同的属性,字段2〜500k个值). 我使用 -Xmx参数将Java堆空间最大化.

I'm running a WEKA classifier (J48 with an input .arff file composed of 3 fields, field 1 has ~27k distinct attributes, field 2 ~ 500k values) in a latest generation Macbook Pro with 8GB RAM. I increased the java heap space to the maximum possible using the -Xmx parameter:

java -Xmx7G -cp weka-3-6-10/weka.jar weka.classifiers.trees.J48 -t myfiles/loc_linear.arff -i

java -Xmx7G -cp weka-3-6-10/weka.jar weka.classifiers.trees.J48 -t myfiles/loc_linear.arff -i

但是,当我运行分类器(大约10分钟后)时,出现错误"线程主"中的异常java.lang.OutOfMemoryError:Java堆空间".

however when I run the classifier (after about 10 minutes) I get the error "Exception in thread "main" java.lang.OutOfMemoryError: Java heap space".

很明显,我的输入文件只有8GB RAM.这是否意味着唯一的解决方案就是拥有更强大的硬件(例如16GB RAM或非常强大的服务器/群集)? 有没有解决此问题的方法? (例如,减少输入文件?如果是,那么您认为减少的标准是什么?).还有其他想法或建议吗?

Evidently 8GB RAM is not enough with my input file. Does this mean the only solution to this is having a more powerful hardware (e.g. 16GB RAM or a very powerful server/cluster)? Would there be any workaround to this issue? (e.g. reducing the input file? If so, which would be in your opinion the criteria to apply in the reduction?). Any other ideas or suggestions?

推荐答案

如果在Mac OS X计算机上运行Weka GUI,则可以编辑plist配置文件.我遵循了Weka邮件列表中的说明. /p>

If you are running the Weka GUI on a Mac OS X machine, you can edit a plist configuration file. I followed instructions from the Weka mailing list.

  1. cd进入/Applications/weka-XXX.app/Contents或安装了您的weka可执行文件的任何位置.

  1. cd into /Applications/weka-XXX.app/Contents , or wherever your weka executable was installed.

那里将有一个名为Info.plist的文件.建议您将该文件的副本保存到其他位置,因为下一步需要进行更改.

There will be a file called Info.plist there. I suggest you save a copy of that file to another location, as you'll need to change it in the next step.

在您喜欢的文本编辑器中打开weka-XXX.app/Contents/Info.plist(XML)文件,然后查找显示"VMOptions"的块.应该有一个表示"-Xmx256M"的值,用于指定内存.将该值更改为更大的值,例如"-Xmx1024M".

Open the weka-XXX.app/Contents/Info.plist (XML) file in your favorite text editor and look for a block that says "VMOptions". There should be a value that says "-Xmx256M" which specifies the memory. Change that value to something bigger, like "-Xmx1024M".

启动Weka.

这篇关于是否有解决方法来解决"Java堆空间"问题?已经指定最大堆值时发生内存错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆