如何在 Mac 上的 IntelliJ IDEA 中增加 IDE 内存限制? [英] How to increase IDE memory limit in IntelliJ IDEA on Mac?

查看:42
本文介绍了如何在 Mac 上的 IntelliJ IDEA 中增加 IDE 内存限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Mountain Lion 上使用 IDEA 12 Leda.我想增加 IDE 可以使用的最大内存.我将 Info.plist 文件中的 VMOptions 设置为-Xmx2048m -ea -XX:+HeapDumpOnOutOfMemoryError -Xverify:none -Xbootclasspath/a:../lib/boot.jar

I'm using IDEA 12 Leda on Mountain Lion. I wanted to increase the maximum memory that IDE can use. I set the VMOptions in Info.plist file to be -Xmx2048m -ea -XX:+HeapDumpOnOutOfMemoryError -Xverify:none -Xbootclasspath/a:../lib/boot.jar

当我打开IDEA时,我仍然看到最大内存为711m.

When I open up IDEA, I still see the maximum memory to be 711m.

jps -v 显示我的 VMOptions 已加载,但被以下选项替换.

jps -v shows my VMOptions has been loaded but it's replaced by the following options.

29388  **-Xmx2048m** -ea -XX:+HeapDumpOnOutOfMemoryError -Xverify:none -Xbootclasspath/a:../lib/boot.jar -Xms128m **-Xmx800m** -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=64m -XX:+UseCodeCacheFlushing -XX:+UseCompressedOops -Didea.paths.selector=IdeaIC12 -Dsun.java2d.noddraw=true -Didea.max.intellisense.filesize=2500 -Didea.dynamic.classpath=false -Didea.jars.nocopy=false -Dsun.java2d.d3d=false -Dapple.awt.fullscreencapturealldisplays=false -Dapple.laf.useScreenMenuBar=true -Djava.endorsed.dirs= -Dswing.bufferPerWindow=false -Didea.fatal.error.notification=enabled -Didea.cycle.buffer.size=1024 -Didea.popup.weight=heavy -Didea.xdebug.key=-Xdebug -Dapple.awt.graphics.UseQuartz=true -Dsun.java2d.pmoffscreen=false -Didea.no.launcher=false -DCVS_PASSFILE=~/.cvspass -Didea.use.default.antialiasing.in.editor=false -Dcom.apple.mrj.application.live-resize=false -Didea.smooth.progress=false
29392 Jps -Dapplication.home=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home -Xms8m

-Xmx800 从何而来?我需要删除它.

Where does -Xmx800 come from? I need to remove it.

推荐答案

当前版本:Help |更改内存设置:

自 IntelliJ IDEA 15.0.4 起,您还可以使用:Help |编辑自定义虚拟机选项...:

Since IntelliJ IDEA 15.0.4 you can also use: Help | Edit Custom VM Options...:

这将自动在 config 文件夹中创建 .vmoptions 文件的副本,并打开一个对话框进行编辑.

This will automatically create a copy of the .vmoptions file in the config folder and open a dialog to edit it.

旧版本:

IntelliJ IDEA 12 是一个已签名的应用程序,因此不再建议更改 Info.plist 中的选项,因为签名将不匹配,并且您会遇到取决于您的系统安全设置的问题(应用程序将要么不运行,要么每次启动时防火墙都会报错,或者应用将无法使用系统密钥库来保存密码).

IntelliJ IDEA 12 is a signed application, therefore changing options in Info.plist is no longer recommended, as the signature will not match and you will get issues depending on your system security settings (app will either not run, or firewall will complain on every start, or the app will not be able to use the system keystore to save passwords).

由于解决了 IDEA-94050,提供 JVM 选项的新方法是在 IDEA 12 中引入:

As a result of addressing IDEA-94050 a new way to supply JVM options was introduced in IDEA 12:

现在它可以从~/Library/Preferences//idea.vmoptions 和系统属性来自 ~/Library/Preferences//idea.properties.

Now it can take VM options from ~/Library/Preferences/<appFolder>/idea.vmoptions and system properties from ~/Library/Preferences/<appFolder>/idea.properties.

例如,要使用 -Xmx2048m 选项,您应该从 /Applications/IntelliJ IDEA.app/bin/idea.vmoptions 复制原始 .vmoptions 文件~/Library/Preferences/IntelliJIdea12/idea.vmoptions,然后修改 -Xmx 设置.

For example, to use -Xmx2048m option you should copy the original .vmoptions file from /Applications/IntelliJ IDEA.app/bin/idea.vmoptions to ~/Library/Preferences/IntelliJIdea12/idea.vmoptions, then modify the -Xmx setting.

最终文件应如下所示:

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

复制原始文件很重要,因为选项未添加,而是替换.

Copying the original file is important, as options are not added, they are replaced.

这样您的自定义选项将在更新之间保留,应用程序文件将保持不变,使签名检查器满意.

This way your custom options will be preserved between updates and application files will remain unmodified making signature checker happy.

社区版:使用 ~/Library/Preferences/IdeaIC12/idea.vmoptions 文件代替.

这篇关于如何在 Mac 上的 IntelliJ IDEA 中增加 IDE 内存限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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