Java 我应该如何为 IntelliJ 14 设置内存?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28760415/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 06:45:41  来源:igfitidea点击:

How should I set the memory for IntelliJ 14?

javaintellij-idea

提问by Sky

I just upgraded my IntelliJ to 14.0.3. But there's always a Out Of Memory dialog popped up to ask me to set the memory.

我刚刚将 IntelliJ 升级到 14.0.3。但是总是弹出一个内存不足的对话框,要求我设置内存。

Following is my settings: enter image description here

以下是我的设置: 在此处输入图片说明

I thought it's enough. But the dialog shows from time to time, and sometimes, it's no responding that I have to shutdown it.

我以为这就够了。但是对话框不时显示,有时,我必须关闭它没有响应。

How should set this for IntelliJ 14? Any ideas?

应该如何为 IntelliJ 14 设置这个?有任何想法吗?

采纳答案by Cataclysm

Open Intellij IDE's vmoptionsfile

打开 Intellij IDE 的vmoptions文件

For Mac Users

对于 Mac 用户

Help | Edit Custom VM Options...

Help | Edit Custom VM Options...

or

或者

Library > Preferences > Idea<YourVersion> > idea.vmoptions

Library > Preferences > Idea<YourVersion> > idea.vmoptions

For Window (32bit) Users

适用于 Window(32 位)用户

C:\Program Files (x86)\JetBrains\IntelliJ IDEA <your_version>\bin\idea.exe.vmoptions

C:\Program Files (x86)\JetBrains\IntelliJ IDEA <your_version>\bin\idea.exe.vmoptions

For Window (64bit) Users

对于 Window(64 位)用户

C:\Program Files (x86)\JetBrains\IntelliJ IDEA <your_version>\bin\idea64.exe.vmoptions

C:\Program Files (x86)\JetBrains\IntelliJ IDEA <your_version>\bin\idea64.exe.vmoptions

and setup it's memory as you wish. Below is sample settings for 2GB

并根据需要设置它的内存。以下是2GB 的示例设置

-Xms128m
-Xmx2048m
-XX:MaxPermSize=350m
-XX:ReservedCodeCacheSize=240m
-XX:+UseCodeCacheFlushing
-XX:+UseCompressedOops

Hopefully this help.

希望这有帮助。

回答by hidro

If you still see this popup frequently even with high memory allocated, try:

如果即使分配了大量内存,您仍然经常看到此弹出窗口,请尝试:

File > Invalidate Caches / Restart...

文件 > 使缓存无效/重新启动...

回答by Peter Gromov

It really depends on the nature of the error. One thing to try is using idea64.exe instead of idea.exe.

这实际上取决于错误的性质。要尝试的一件事是使用idea64.exe 而不是idea.exe。

If this doesn't help, please contact JetBrains by filing an issue to https://youtrack.jetbrains.com/newissueand attach your log there (Help | Show log).

如果这没有帮助,请通过向https://youtrack.jetbrains.com/newissue提交问题来联系 JetBrains ,并将您的日志附在那里(帮助 | 显示日志)。

回答by Sarneet Kaur

I have allocated 4 GB to intelliJ 14 on windows 7. My settings in idea64.exe.vmoptions are :

我在 windows 7 上为 intelliJ 14 分配了 4 GB。我在 idea64.exe.vmoptions 中的设置是:

-Xms4608m
-Xmx4608m
-Xmn2g
-Xss128k
-XX:MaxPermSize=1536m
-XX:ParallelGCThreads=20

-Xms4608m
-Xmx4608m
-Xmn2g
-Xss128k
-XX:MaxPermSize=1536m
-XX:ParallelGCThreads=20

回答by martoncsukas

You can set IntelliJ IDEA's memory settings andyour application's memory settings in the following places:

您可以在以下位置设置 IntelliJ IDEA 的内存设置应用程序的内存设置:

IDEA's vmoptions file:

IDEA 的 vmoptions 文件:

Under Windows it could be either of the followings, depending on which installation (x86, x64) you use:

在 Windows 下,它可能是以下之一,具体取决于您使用的安装(x86、x64):

  • C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.3.4\bin\idea.exe.vmoptions
  • C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.3.4\bin\idea64.exe.vmoptions
  • C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.3.4\bin\idea.exe.vmoptions
  • C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.3.4\bin\idea64.exe.vmoptions

VM Options in the Run/Debug Configuration:

运行/调试配置中的 VM 选项:

enter image description here

在此处输入图片说明