scala IntelliJ IDEA 13 CE 消耗大量 CPU

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21595289/
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-10-22 06:03:09  来源:igfitidea点击:

IntelliJ IDEA 13 CE consuming lots of CPU

scalaintellij-idea

提问by K P

I upgraded from IntelliJ IDEA from 12 CE to 13 CE few days ago and it has been hogging up CPU. Every few minutes it'll peak to 450-500% and then come down to 100-200%. Also, I've upgraded my Scala plugin to 0.30.380. Not sure what's causing the issue!?

几天前我从 IntelliJ IDEA 从 12 CE 升级到 13 CE,它一直在占用 CPU。每隔几分钟它就会达到 450-500% 的峰值,然后下降到 100-200%。此外,我已将我的 Scala 插件升级到 0.30.380。不知道是什么导致了这个问题!?

回答by ziggystar

I'm posting this comment by K P as an answer, because K P does not have enough reputation.

我通过 KP 发布此评论作为答案,因为 KP 没有足够的声誉。

It just needed some more memory to prevent repeated garbage collection. I found the file idea.vmoptions [aka idea64.exe.vmoptions] and increased the memory for InteiiJ to run (Xms = 512m and Xmx = 2048). The CPU usage has come down to 0.2 - 10% when nothing is being done on it.

它只需要更多的内存来防止重复的垃圾收集。我找到了idea.vmoptions [又名idea64.exe.vmoptions] 文件并增加了InteiiJ 运行的内存(Xms = 512m 和Xmx = 2048)。当什么都不做时,CPU 使用率已降至 0.2 - 10%。

回答by user2982704

Go to your home folder, then navigate to .IntelliJIdea13\config\options

转到您的主文件夹,然后导航到 .IntelliJIdea13\config\options

Edit the file project.default.xmlby changing the VM_PARAMETERSXmxand Xmsas follows:

project.default.xml通过更改VM_PARAMETERSXmxXms来编辑文件,如下所示:

<option name="VM_PARAMETERS" value="-Xmx2048m -Xms512m -XX:MaxPermSize=250m -ea" />

<option name="VM_PARAMETERS" value="-Xmx2048m -Xms512m -XX:MaxPermSize=250m -ea" />

It decreased the CPU usage to 50%.

它将 CPU 使用率降低到 50%。

回答by demian

Try clean up cache and restart. In Intellij 14 go to menu File -> Invalidate Caches / Restart...

尝试清理缓存并重新启动。在 Intellij 14 中,转到菜单 File -> Invalidate Caches / Restart...

回答by xlaoyu.Lee

As other said,increasing memory heap of IDEA is work, my IDEA version is 2016.3.4, following is setting way

正如其他人所说,增加IDEA的内存堆是可行的,我的IDEA版本是2016.3.4,以下是设置方式

  1. Do one of the following:
    • Use the main menu command Help | Edit Custom VM Options to create a copy of the idea.vmoptions file in the user home. Refer to Edit Custom VM Options for details.
    • Copy the existing file from the IntelliJ IDEA installation folder somewhere and save the path to this location in the environment variable IDEA_VM_OPTIONS.
    • Copy the existing file /bin/idea.exe.vmoptions or /bin/idea64.exe.vmoptions from the IntelliJ IDEA installation folder into the location under your user home.
  1. 执行以下操作之一:
    • 使用主菜单命令帮助 | 编辑自定义 VM 选项以在用户主目录中创建 idea.vmoptions 文件的副本。有关详细信息,请参阅编辑自定义 VM 选项。
    • 从某个地方的 IntelliJ IDEA 安装文件夹复制现有文件,并将路径保存在环境变量 IDEA_VM_OPTIONS 中。
    • 将现有文件 /bin/idea.exe.vmoptions 或 /bin/idea64.exe.vmoptions 从 IntelliJ IDEA 安装文件夹复制到用户主目录下的位置。

回答by pd12

If anyone's wondering the "right" way to edit the idea.vmoptions or idea64.vmoptions file, here it is: https://www.jetbrains.com/idea/help/tuning-intellij-idea.html

如果有人想知道编辑idea.vmoptions 或idea64.vmoptions 文件的“正确”方式,请访问:https://www.jetbrains.com/idea/help/tuning-intellij-idea.html

On *NIX, you want to copy

在 *NIX 上,您要复制

<IntelliJ IDEA installation folder>/bin/idea64.vmoptions

to:

到:

$HOME/.IntelliJIdeaXX/idea64.vmoptions

and edit that file to increase the heap memory for IntelliJ IDEA

并编辑该文件以增加 IntelliJ IDEA 的堆内存

(OP's example settings: Xms = 512m and Xmx = 2048)

(OP 的示例设置:Xms = 512m 和 Xmx = 2048)