Java 堆空间内存不足错误

Java 堆空间内存不足错误,java,netbeans,nlp,stanford-nlp,Java,Netbeans,Nlp,Stanford Nlp,我正在尝试用以下程序运行coreNLP包 package corenlp; import edu.stanford.nlp.pipeline.*; import java.io.IOException; /** * * @author Karthi */ public class Main { /** * @param args the command line arguments */ public static void main(String[]

我正在尝试用以下程序运行coreNLP包

package corenlp;
import edu.stanford.nlp.pipeline.*;
import java.io.IOException;
/**
 *
 * @author Karthi
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        // TODO code application liogic here
        String str="-cp stanford-corenlp-2010-11-12.jar:stanford-corenlp-models-2010-11-06.jar:xom-1.2.6.jar:jgrapht-0.7.3.jar -Xms3g edu.stanford.nlp.pipeline.StanfordCoreNLP [ -props <Main> ] -file <input.txt>";
        args=str.split(" ");
        StanfordCoreNLP scn=new StanfordCoreNLP();
        scn.main(args);
    }

}
-Xmx3g

run:
Error occurred during initialization of VM
Could not create the Java virtual machine.
Could not reserve enough space for object heap
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
-Xms3g-Xmx4g

run:
Could not create the Java virtual machine.
Invalid maximum heap size: -Xmx4g
The specified size exceeds the maximum representable size.
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)

你在哪个操作系统上运行这个?它是64位系统吗?如果没有,那么当涉及到可以为单个Java进程分配多少堆时,您将受到很大的限制。尝试使用
-Xms1024M-Xmx1024M运行,看看它是否解决了您的问题。

尝试使用运行时参数

java-cp-XX:+AggressiveHeap-jar jarfile


java-cp-XX:MaxHeapFreeRatio=70-XX:+UseLargePages-jar jarfile

请继续并接受您之前的一些问题..谢谢我已经接受了我之前问题的答案是64位系统,斯坦福websiite说它需要至少3gb的堆空间开始运行。。但5分钟后,它报告内存不足错误again@karthi:奇怪;如果它是64位操作系统上的64位虚拟机,那么应该不会有问题<代码>3G
什么都不是。我们在生产服务器上运行了大约8个虚拟机,每个虚拟机大约有4096M。尝试删除现有参数并使用
-Xms4096M-Xmx4096M
。是。。这就是问题所在。。该系统附带预安装的32位jvm。。现在下载并安装了64位,希望它能工作。我应该在哪里给出这些参数?。。我对这些heapspace选项不熟悉
run:
Error occurred during initialization of VM
Could not create the Java virtual machine.
Could not reserve enough space for object heap
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
run:
Could not create the Java virtual machine.
Invalid maximum heap size: -Xmx4g
The specified size exceeds the maximum representable size.
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)