`

升级到jdk6 update21 eclipse 遇到PermGen的问题

阅读更多

 

由于xp操作系统用了很久,ghost恢复了一下,裸机上索性全部安装最新的,将jdk升级到最新版本的jdk6u21,随机启动eclipse,发现打开文件特别卡,然后eclipse直接关闭,当写代码自动提示时,卡,eclipse很不礼貌的关闭,没任何提示,这个版本的eclipse用了很久,所以怀疑新装jdk的问题,反复测试发现了一个弹出框,有PermGen字眼,然后google索索,找到一片文章解决了我的问题,特别翻译出来,以备后来人!

 

 

If you recently upgraded to JDK 6 update 21 on Windows

and are noticing lots of Eclipse problems, 

如果最近将jdk升级到jdk6u21(windows用户),那么eclipse会出现很多问题

 

I probably know why (and can show you how to fix it).

 

First, some background. The HotSpot VM (Sun’s implementation)

has a concept known as the Permanent Generation,

or PermGen for short. Its main purpose is to confound users and it is rumored 

to be going away in future releases of HotSpot.

 

首先,了解一些背景知识,HotSpot VM(sun的实现)有一个永生代的概念(缩写PermGen),

它的主要目的是to confound users (不知如何翻译),听说将在以后的HotSpot版本中移除

 

By default, the VM allocates 64 MB for the PermGen space, which is often enough. 

However, Eclipse installations with a lot of plugins tend to need a lot more.

默认,虚拟机给永生代分配64M的内存空间,通常是足够的,

然而,eclipse安装了太多的插件,需要更多的内存

 

Because Eclipse is meant to work on multiple JVMs,

the stock eclipse.ini doesn’t directly set the PermGen size,

it has a line that looks like this:

由于Eclipse有意工作在多虚拟机下,配置文件eclipse.ini不能直接设置PermGen的大小,文件中有如下一行:

 

 

–launcher.XXMaxPermSize

256m

 

 

That will tell the Eclipse launcher to set the perm size, 

if it is running on the HotSpot VM. Unfortunately,

it appears this quit working with update 21

– a quick check with VisualVM showed that this flag wasn’t working 

这个配置告诉eclipse启动器,如果在 HotSpot VM上运行的话, 设置PermGen 大小,遗憾的是,

它似乎在jdku21版本中不工作了!

 

and no matter what you set it to, your VM would have only 64MB of PermGen space.

虽然你设置了,但是虚拟机仍然只有64M的PermGen空间

 

It appears that the cause of this is that with update 21,

the vendor flag was changed to Oracle, which broke Eclipse’s VM detection code.

Thus, the flag is never being passed through to the VM.

It appears as though this only happens on Windows and only 

when running the Sun (sorry, I’ll never call it Oracle) JVM.

 

Fortunately, it is easy to fix. Simply add this flag to the

-vmargs section of your eclipse.ini (it should be at or near the bottom):

幸运的是,这个问题非常容易的就解决了,在配置文件eclipse.ini的-vmargs部分简单的添加如下标志

(添加在最下面或者最下的附近位置)

-XX:MaxPermSize=256M

 

That will directly set the PermGen size 

and should fix any PermGen errors you were running into.

 

此标记将直接设置PermGen的大小,解决运行时PermGen的错误

 

Who knows what else changing the vendor flag broke?

2
1
分享到:
评论
1 楼 cuixiping 2010-07-27  
我也被这个问题蹂躏过

相关推荐

Global site tag (gtag.js) - Google Analytics