Intellij 偶尔无法为对象堆保留足够的空间 [英] Intellij occasionally unable to reserve enough space for object heap

查看:35
本文介绍了Intellij 偶尔无法为对象堆保留足够的空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

RESOLVED 检查下面的解决方案.

RESOLVED check below for solution.

我使用的是 Intellij Idea 2017.2.2.以下是我的 Intellij 规格.

I'm using Intellij Idea 2017.2.2. Below is my intellij Specs.

我的 Intellij 只会偶尔失败 maven 构建或 jboss 服务器启动并出现错误

My Intellij would only occasionally fail a maven build or a jboss server start with the error

Error occurred during initialization of VM
Could not reserve enough space for 1048576KB object heap

如果我要使用

-Xms512m -Xmx1024m

-Xms512m -Xmx1024m

构建会失败 10 次中的 9 次(不是每 10 次,而是随机).但是在第 10 次它会起作用.我只需要一直按下安装按钮,直到它工作.

The build would fail 9 out of 10 times (not exactly every 10th, but just randomly). But on the 10th time it would work. I simply have to keep pressing the install button until it works.

之前的一个主要问题是,如果我不指定 vm args,那么构建将进行到一半,然后在用完 Java 堆空间时失败.

This was a major problem before was that if I don't specify the vm args then the build would go about halfway then fail on running out of java heap space.

对于我的 jboss 服务器 (JBOSS6.4 - 7.5.0.Final redhat 21),可以观察到完全相同的行为,其中服务器将无法启动 10 次中的 9 次.然后随机启动,因为它没有.

The same exact behavior can be observed for my jboss server (JBOSS6.4 - 7.5.0.Final redhat 21), where the server would fail to start 9 out of 10 times. Then start up as randomly as it does not.

规格

IntelliJ IDEA 2017.2.2

IntelliJ IDEA 2017.2.2

Build #IU-172.3757.52,建于 2017 年 8 月 14 日

Build #IU-172.3757.52, built on August 14, 2017

授权-----

订阅有效期至 2018 年 5 月 31 日

Subscription is active until May 31, 2018

JRE:1.8.0_152-release-915-b10 amd64

JRE: 1.8.0_152-release-915-b10 amd64

JVM:JetBrains s.r.o 的 OpenJDK 64 位服务器虚拟机

JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

Windows 7 6.1

Windows 7 6.1

我测试了什么

我从 Intellij 2017.1 升级到 2017.2 并且行为没有改变.

I upgraded from Intellij 2017.1 to 2017.2 and the behavior did not change.

我也尝试在 Eclipse 上做同样的事情,但也没有帮助.

I also tried to do the same on Eclipse which also did not help.

干净地重新启动 PC,然后关闭所有不必要的应用程序,打开 Intellij 执行 Maven 构建,但它失败了,但再点击几下,它的工作方式与往常一样不一致.(注意此时16只用了6gb,不可能是内存不足)

Clean restart of PC, then close all the unnecessary apps, open intellij do a maven build and yet it fails, but a few more clicks and it works inconsistently as usual. (note at this moment only 6gb out of 16 is used, there is no way there is an insufficiency with memory)

*编辑

这台电脑有 16 GB 的内存.虽然失败正在发生,但当时正在使用大约 9.5GB.

This PC have 16 gb of ram. While the fails are happening about 9.5GBs are being used at that moment.

推荐答案

最终我能够通过更新正确的 JDK 来解决这个问题.我的项目使用了不正确的 JDK,因此运行的是 32 位而不是 64 位 JDK.

Ultimately I was able to resolve the issue by updating the proper JDK. My project was picking up on an incorrect JDK and hence was running the 32 Bit as opposed to 64 bit JDK.

只需在文件 > 项目设置下添加正确的 JDK.

Simply added the correct JDK under File > Project Settings.

我的项目之前似乎从不需要那么多内存,但是一旦需求上升,似乎需要 64 位.

It seemed that my project never required that much memory before, but once the need had risen, it seems that a 64 bit became required.

这篇关于Intellij 偶尔无法为对象堆保留足够的空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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