我怎样才能给 eclipse 更多的内存而不是 512M?

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

How can I give eclipse more memory than 512M?

eclipsememory-management

提问by newbie

I have following setup, but when I put 1024 and replace all 512 with 1024, then eclipse won't start at all. How can I have more than 512M memory for my eclipse JVM?

我有以下设置,但是当我放入 1024 并将所有 512 替换为 1024 时,eclipse 根本无法启动。我的 Eclipse JVM 如何拥有超过 512M 的内存?

-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-product
com.springsource.sts.ide
--launcher.XXMaxPermSize
512M
-vm
C:\Program Files (x86)\Java\jdk1.6.0_18\bin\javaw 
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms512m
-Xmx512m
-XX:MaxPermSize=512m

回答by Kaleb Pederson

I've had a lot of problems trying to get Eclipse to accept as much memory as I'd like it to be able to use (between 2 and 4 gigs for example).

我在试图让 Eclipse 接受尽可能多的内存时遇到了很多问题(例如,在 2 到 4 个演出之间)。

Open eclipse.iniin the Eclipse installation directory. You should be able to change the memory sizes after -vmargsup to 1024 without a problemup to some maximum value that's dependent on your system. Here's that section on my Linux box:

eclipse.ini在 Eclipse 安装目录中打开。您应该能够在之后更改内存大小-vmargs高达 1024 没有问题最多取决于您的系统的某个最大值。这是我的 Linux 机器上的那部分:

-vmargs
-Dosgi.requiredJavaVersion=1.5
-XX:MaxPermSize=512m
-Xms512m
-Xmx1024m

And here's that section on my Windows box:

这是我的 Windows 盒子上的那个部分:

-vmargs
-Xms256m
-Xmx1024m

But, I've failed at setting it higher than 1024 megs. If anybody knows how to make that work, I'd love to know.

但是,我未能将其设置为高于 1024 megs。如果有人知道如何进行这项工作,我很想知道。

EDIT: 32bit version of juno seems to not accept more than Xmx1024m where the 64 bit version accept 2048.

编辑:juno 的 32 位版本似乎不接受超过 Xmx1024m 的 64 位版本接受 2048。

EDIT: Nick's post contains some great links that explain two different things:

编辑:尼克的帖子包含一些很好的链接,解释了两个不同的事情:

  • The problem is largely dependent on your systemand the amount of contiguous free memory available, and
  • By using javaw.exe (on Windows), you may be able to get a larger allocated block of memory.
  • 该问题在很大程度上取决于您的系统和可用的连续可用内存量,并且
  • 通过使用 javaw.exe(在 Windows 上),您可以获得更大的分配内存块。

I have 8 gigs of Ram and can't set -Xmxto more than 1024 megs of ram, even when a minimal amount of programs are loaded and both windows/linux report between 4 and 5 gigs of free ram.

我有 8 场内存,并且不能设置-Xmx为超过 1024 兆内存,即使加载了最少量的程序并且 windows/linux 都报告了 4 到 5 场可用内存。

回答by Ibn Saeed

Here is how i increased the memory allocation of eclipse Juno:

以下是我增加 eclipse Juno 内存分配的方法:

enter image description here

在此处输入图片说明

I have a total of 4GB on my system and when im working on eclipse, i dont run any other heavy softwares along side it. So I allocated 2Gb.

我的系统上总共有 4GB 空间,当我在 eclipse 上工作时,我不会在它旁边运行任何其他重型软件。所以我分配了2Gb。

The thing i noticed is that the difference between min and max values should be of 512. The next value should be let say 2048 min + 512 = 2560max

我注意到的是最小值和最大值之间的差异应该是 512。下一个值应该是 2048 min + 512 = 2560max

Here is the heap value inside eclipse after setting -Xms2048m -Xmx2560m:

这是设置后eclipse内部的堆值-Xms2048m -Xmx2560m

enter image description here

在此处输入图片说明

回答by Nick Veys

Care and feeding of Eclipse's memory hunger is a pain...

照顾和喂养 Eclipse 的记忆饥饿是一种痛苦......

More or less, keep trying smaller amounts til it works, that's your max.

或多或少,继续尝试较小的量直到它起作用,这是你的最大值。

回答by GuruKulki

You can copy this to your eclipse.inifile to have 1024M:

您可以将其复制到您的eclipse.ini文件中以获得 1024M:

-clean -showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vmargs
-Xms512m
-Xmx1024m
-XX:PermSize=128m
-XX:MaxPermSize=256m 

回答by elduff

I don't think you need to change the MaxPermSize to 1024m. This works for me:

我认为您不需要将 MaxPermSize 更改为 1024m。这对我有用:

-startup
plugins/org.eclipse.equinox.launcher_1.0.200.v20090520.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-product
org.eclipse.epp.package.jee.product
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms256m
-Xmx1024m
-XX:PermSize=64m
-XX:MaxPermSize=128m

回答by anon58192932

While working on an enterprise project in STS (heavily Eclipse based) I was crashing constantly and STS plateaued at around 1GB of RAM usage. I couldn't add new .war files to my local tomcat server and after deleting the tomcat folder to re-add it, found I couldn't re-add it either. Essentially almost anything that required a new popup besides the main menus was causing STS to freeze up.

在 STS(主要基于 Eclipse)中从事企业项目时,我不断崩溃,STS 稳定在大约 1GB 的 RAM 使用量。我无法将新的 .war 文件添加到我的本地 tomcat 服务器,并且在删除 tomcat 文件夹以重新添加它后,发现我也无法重新添加它。基本上,除了主菜单之外,几乎所有需要新弹出窗口的东西都会导致 STS 冻结。

I edited the STS.ini (your Eclipse.ini can be configured similarly) to:

我将 STS.ini(您的 Eclipse.ini 可以类似配置)编辑为:

--launcher.XXMaxPermSize 1024M -vmargs -Xms1536m -Xmx2048m -XX:MaxPermSize=1024m

--launcher.XXMaxPermSize 1024M -vmargs -Xms1536m -Xmx2048m -XX:MaxPermSize=1024m

Rebooted STS immediately and saw it plateau at about 1.5 gigs before finally not crashing

立即重新启动 STS 并看到它在大约 1.5 gigs 时处于稳定状态,然后最终没有崩溃

回答by Skidrow

Configuring this worked for me: -vmargs -Xms1536m -Xmx2048m -XX:MaxPermSize=1024m on Eclipse Java Photon June 2018

配置这个对我有用:-vmargs -Xms1536m -Xmx2048m -XX:MaxPermSize=1024m on Eclipse Java Photon June 2018

Running Windows 10, 8 GB ram and 64 bit. You can extend -Xmx2048 -XX:MaxpermSize= 1024m to 4096m too, if your computer has good ram.Mine worked well.

运行 Windows 10、8 GB 内存和 64 位。您也可以将 -Xmx2048 -XX:MaxpermSize= 1024m 扩展到 4096m,如果您的计算机具有良好的内存。我的运行良好。