[资料整合] Oracle HotSpot VM计划移除PermGen
在已经发布的Oracle JDK7 RC(JDK7 build 147)里,HotSpot VM仍然有PermGen,但许多原本存储在PermGen里的东西已经挪到了别的地方。
离HotSpot彻底移除PermGen的一天已经越来越近。本来PermGen就不是一个JVM完整不可分割的一部分,去了就去了呗。正好把许多同学们对PermGen的误解给扭过来
这草稿压箱底够久了,虽然还是乱七八糟的但还是先发出来吧,方便大家搜资料。
请重点关注JEP 122: Remove the Permanent Generation。这是移除PermGen的官方提案。
=========================================================================
Interned Strings and class static variables have been moved to the regular Java heap,
and Symbols into malloc'ed memory in hs21 (the current development version).
The rest of the metadata will go into per classloader+classes-it-loads arenas, one
per classloader. See allocation.* for arena implementation. You'll note that an
arena consists of fixed-sized malloc'ed chunks. The current plan is to dump these
into the CDS archive, though whether we'll make them relocatable or not is up in
the air. In theory, it should be possible to map the chunks at their old addresses
in a new process, because the space was available when the archive was created.
We might do what Linux does with shared libs, namely have a preferred address
and relocate if we can't get that address.
Bug 6964458: Reimplement class meta-data storage to use native memory
=========================================================================
时间线
2010-01-27
Oracle终于得以正式收购Sun。在新闻发布会上,
Oracle + Sun: Transforming the IT Industry
Thomas Kurian做了题为“Software Strategy ”的主题演讲 (演示稿下载)
其中在5:00左右,他提到了关于Java SE的展望,
2010-10-03
JavaOne 2010上,题为“Oracle's JVM Strategy”的演讲同样提到要将HotSpot与JRockit合并到一起,并透露了更多细节:以HotSpot为主,将JRockit一些优秀的部分移植到HotSpot中。其中,同样提到了要移除“permanent generation”。
Henrik St?hl: Oracle's JVM Strategy (演示稿下载)
One of the solutions to this problem is to use native C memory for the VM's representation of the Java program. This is currently our chosen solution. The SymbolTable and associated symbols are one type in the JVM that needs to move into native memory, from permgen. The symbols are shared among class loaders so need to be reference counted so that when unreferenced, they are freed.
This work supports bugid 6964458
Posted Date : 2010-10-08 20:24:43.0
2010-11-05
Request for review (XL) 6990754: Use native memory and reference counting to implement SymbolTable
http://bugs.sun.com/view_bug.do?bug_id=7019689 << 关联bug
http://bugs.sun.com/view_bug.do?bug_id=7019165 << 关联bug
Bug ID:7019165
Votes0
SynopsisIncorrect symbols in pstack output after SymbolTable changes
Categoryhotspot:runtime_system
Reported Against
Release Fixed hs21(b05), 7(b135) (Bug ID:2208133)
State11-Closed, Unverified, bug
Priority:3-Medium
Related Bugs 6990754
Submit Date11-FEB-2011
2011-01-27
HotSpot要干掉PermGen了…
OpenJDK 7/HotSpot revision 3582bf76420e (changeset 2059): 6990754: Use native memory and reference counting to implement SymbolTable
The method area is created on virtual machine start-up. Although the method area is logically part of the heap, simple implementations may choose not to either garbage collect or compact it. This version of the Java virtual machine specification does not mandate the location of the method area or the policies used to manage compiled code. The method area may be of a fixed size or may be expanded as required by the computation and may be contracted if a larger method area becomes unnecessary. The memory for the method area does not need to be contiguous.
A Java virtual machine implementation may provide the programmer or the user control over the initial size of the method area, as well as, in the case of a varying-size method area, control over the maximum and minimum method area size.
The following exceptional condition is associated with the method area:
If memory in the method area cannot be made available to satisfy an allocation request, the Java virtual machine throws an OutOfMemoryError.
The Java HotSpot Performance Engine Architecture
文章太长了,没看完啊,看到这段,难道PermGen的移除就是为了更好的处理dynamic languages在JVM上的运行码? 还有啥原因吗?猜测也行啊,哈哈。 工作中,忙里偷闲啊。。。 2 楼 RednaxelaFX 2011-07-25 chenchao051 写道文章太长了,没看完啊,看到这段,难道PermGen的移除就是为了更好的处理dynamic languages在JVM上的运行码? 还有啥原因吗?猜测也行啊,哈哈。 工作中,忙里偷闲啊。。。
我想说的在这个回帖里已经都说了:http://www.iteye.com/topic/1112592?page=2#2216243。没啥需要加的。