我正在上一门课程,其中使用Maven执行作业,并且项目随附了.pom文件。分配需要大约1.5gb的内存来处理。但是,当提供超过1GB的内存时,我会收到以下输出:
[WARNING] Corrupted STDOUT by directly writing to native stream in forked JVM 1
ExecutionException The forked VM terminated without properly saying goodbye. VM
crash or System.exit called?
Error occurred in starting fork, check output in log
转储显示为:
Corrupted STDOUT by directly writing to native stream in forked JVM 1. Stream
'Error occurred during initialization of VM'.
java.lang.IllegalArgumentException: Stream stdin corrupted. Expected comma
after third character in command 'Error occurred during initialization of VM'.
at org.apache.maven.plugin.surefire.booterclient.output.ForkClient$OperationalData.<init>(ForkClient.java:511)
at org.apache.maven.plugin.surefire.booterclient.output.ForkClient.processLine(ForkClient.java:209)
at org.apache.maven.plugin.surefire.booterclient.output.ForkClient.consumeLine(ForkClient.java:176)
at org.apache.maven.plugin.surefire.booterclient.output.ThreadedStreamConsumer$Pumper.run(ThreadedStreamConsumer.java:88)
at java.lang.Thread.run(Thread.java:748)
有问题的区块是:
<plugin>
<!-- executes test with -Xmx option -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<forkCount>4</forkCount>
<reuseForks>true</reuseForks>
<argLine>-Xmx2048m</argLine>
<useSystemClassLoader>true</useSystemClassLoader>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
在-Xmx设置为大于1g / 1024m的地方,我遇到了上述问题。