gpt4 book ai didi

java - 线程中出现异常 "main"java.lang.OutOfMemoryError : Java heap space not fixed

转载 作者:行者123 更新时间:2023-12-01 22:51:40 24 4
gpt4 key购买 nike

这不是一个重复的问题,我看到this ,我想运行一个java程序并出现此错误:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at edu.stanford.nlp.ie.crf.CRFLogConditionalObjectiveFunction.empty2D(CRFLogConditionalObjectiveFunction.java:892)
at edu.stanford.nlp.ie.crf.CRFLogConditionalObjectiveFunction.<init>(CRFLogConditionalObjectiveFunction.java:134)
at edu.stanford.nlp.ie.crf.CRFLogConditionalObjectiveFunction.<init>(CRFLogConditionalObjectiveFunction.java:117)
at edu.stanford.nlp.ie.crf.CRFClassifier.getObjectiveFunction(CRFClassifier.java:1792)
at edu.stanford.nlp.ie.crf.CRFClassifier.trainWeights(CRFClassifier.java:1798)
at edu.stanford.nlp.ie.crf.CRFClassifier.train(CRFClassifier.java:1713)
at edu.stanford.nlp.ie.AbstractSequenceClassifier.train(AbstractSequenceClassifier.java:763)
at edu.stanford.nlp.ie.AbstractSequenceClassifier.train(AbstractSequenceClassifier.java:751)
at edu.stanford.nlp.ie.crf.CRFClassifier.main(CRFClassifier.java:2917)

根据这个我尝试这个:

java -Xms2000m -cp stanford-ner.jar edu.stanford.nlp.ie.crf.CRFClassifier -prop fa.prop 

但是错误没有修复,我又看到错误了!当我设置的值超过 2000m 时,我的操作系统崩溃了,或者我得到以下输出:

...
...
//stanford log
...

Time to convert docs to data/labels: 8.8 seconds
Killed

如何解决这个问题

编辑:

为此

[stanford-ner]$ java -Xms1G -Xmx50G -cp stanford-ner.jar edu.stanford.nlp.ie.crf.CRFClassifier -prop fa.prop

我有这个错误:

[1000][2000][3000][4000][5000][6000]OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00007f04c7c00000, 1225785344, 0) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 1225785344 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /stanford-ner/hs_err_pid1536.log

最佳答案

不要尝试使用 Xms 选项,

java -Xms2000m -cp stanford-ner.jar edu.stanford.nlp.ie.crf.CRFClassifier -prop fa.prop

尝试使用 Xmx,如下所示,

java -Xmx2000m -cp stanford-ner.jar edu.stanford.nlp.ie.crf.CRFClassifier -prop fa.prop

引用:Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

关于java - 线程中出现异常 "main"java.lang.OutOfMemoryError : Java heap space not fixed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24652768/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com