z*******3 发帖数: 13709 | 1 这个我狗了一下哈
发现permgen只有hotspot有实现
其它的jvm都没有实现,而且在逐步淘汰permgen
那方法区理论上已经算是heap的一部分来实现了
那笼统地可以认为都在heap里面
规范里叫做方法区的抽象区域,与“永久代”并不等价。只是在现在的Oracle (Sun)
HotSpot使用“永久代”来实现方法区而已。
服务器端主流的高性能JVM现在就三种,一个是HotSpot(其中Sun的原始版本用得最多
,由其衍生出来的Azul版与HP版也颇有应用;Apple的Mac OS上的JVM也是从Sun的版本
衍生出来的,不过拿Mac来做服务器的大概不多吧);一个是Oracle (BEA)的JRockit;
还有一个是IBM的JVM,现在主要在用的是J9。这之中,只有HotSpot是有PermGen的,而
JRockit与J9都没有;连Azul版HotSpot也经过改进早已去除了PermGen。概念上说这些
JVM都有符合规范的“方法区”,但并不一定要用PermGen来实现就是了。
甚至连Oracle (Sun)的HotSpot也实质性开始去除PermGen的工作了。请参考最近... 阅读全帖 |
|
i****k 发帖数: 804 | 2 首先要根据exception确定是哪一种 OOME。
常见的 OOME 根据HEAP区域有两类:PermGen 和 Heap。PermGen 类的OOME只会出现在
有permgen概念的JVM,比如HOTSPOT。BEA 的 JROCKIT 不会出现这种问题。
PermGen存放两种对象:Class object 和 interned String。大多数permGen OOME由前
者引起,根本原因是hotspot对 classloader 的 garbage collection 做的不是很好。
这种问题常出现于:1. 开发过程中反复deploy程序。2. 应用的high availability
strategy或者side-by-side deployment strategy 采用了抛弃classloader的设计。3.
病态JSP,TAG, EJB compiler。
PermGen OOME 是常见,well documented,但是普通人极难处理的问题。这类问题的根
源多数在于JVM, SERVER 和应用架构的弊病。其中应用架构问题,常见病因有:
1.误用Thre |
|
n*********n 发帖数: 580 | 3 SUN and IBM JVMs have a permGen space, while BEA's JVM doesn't even have a
permGen space. PermGen is mainly used to store class objects. |
|
z****n 发帖数: 1933 | 4 译者的话:在翻译完这篇新闻后,心情久久不能平静,一个伟大的技术公司就这样倒下
了,难道这真的是“纯技术”公司的宿命么?公司的目标都是获取利润,而Oracle则将
这一理念发挥到了极致:凡是与利润不相干的一律干掉,原文用“ruthlessly profit
focused”来形容Oracle对利润的渴求。当然了,对利润的追逐本身无可厚非,可能我
还是太傻太天真:-)。再也看不到Sun的首页了,感觉 Oracle的首页给人一种冷冰冰
的感觉。
再一次将Java之父James Gosling博文中的图片发布在这里,以悼念年仅28岁的伟大的
Sun公司。
历经近9个月的漫长等待后,Oracle终于获得欧盟的批准成功完成对Sun的收购。近日
Oracle宣布了对Sun技术与平台的未来规划。
Java、JVM及JVM上的各种语言
Oracle产品开发高级副总裁Thomas Kurian说,Oracle计划集成Sun HotSpot与Oracle
JRockit Java虚拟机;他又补充到,Oracle打算”振兴“Java开发者社区并将Java编程
模型的触角延伸到新近涌现的应用开发范式上来。比如说... 阅读全帖 |
|
r*****l 发帖数: 2859 | 5 This is inline with what I thought. Thanks.
Now there is something more interesting. If I have a class Singleton, look
at the code below:
private static final Singleton instance_ = new Singleton();
Suppose reference to the Singleton class (value of "instance_") is stored in
permgen, then what about the Singleton object. It has the same life cycle
as instance_ so it makes sense to store it in permgen. However, I do believe
they will be stored in normal heap (finally tenured) cause otherwise the
p... 阅读全帖 |
|
s******e 发帖数: 493 | 6 I doubt that a simple yes or no will be able to answer this question
correctly.
Java objects basically can be divided into class object and instance object.
All instance objects are saved in the heap. Even for a static member of a
class. In such a case, only the class variable will be in permgen. But all
class objects will be in permgen.
If my memory is correct, JMM spec mentions four types of memory space: stack
, heap, permgen and code cache. |
|
b******y 发帖数: 9224 | 7
evidence
Sorry, no.
I read several sites online, but none of the sites could give definitive
answer. I guess it is just per VM implementation maybe.
But, your question about the "dangling" reference in the permgen sounds
interesting I guess maybe the java vm has some way to keep track of that?
I guess what I would do in that case, before garbage collect any object from
the heap, I would check if that object is referenced by any from the
permgen.
Maybe a question for Oracle ;-) |
|
r*****l 发帖数: 2859 | 8 Read the JVM Specs. All field metadata is stored in the permgen (method area
). Static variable each has a reference to a ConstanceValue data structure,
also in permgen. The value can be of type long, float, double, int (short,
char, etc.), and string. The Specs does not specify how a object reference
is stored (or at least I did not find it). Maybe it's like this: if the type
of the field is not primitive, then the value stored in the ConstantValue
data structure is interpreted as an object ref... 阅读全帖 |
|
z*******3 发帖数: 13709 | 9 这里面有几个小疑点
一个是方法区的实现是否在heap里面实现
还是额外滴在heap以外的地方实现
如果是在PermGen里面实现的话
就要看看static变量的主体是否在这个区里面
不过如果smectite说得是对的话
static变量其实只存引用在permgen里面
然后主体还是在heap里面
是不是这样理解?
这个是虚拟机的问题 |
|
|
Q********3 发帖数: 143 | 11 非大牛
jprofiler, jconsole可以
JNI可能造成泄露,强引用无用的对象会造成内存浪费
OOM一般分为两大类
一是heap OOM,
1.用jprofiler看是那些对象占用了大部分内存,然后分析这些地方是否可以优化
2.调整jvm的内存参数Xms,Xmx
二是permgen space OOM
调整jvm参数,permsize 和maxpermsize
监视内存使用情况可以用MBean,很多大公司都有一套系统去监控CPU,内存,硬盘使用
情况 |
|
r*****l 发帖数: 2859 | 12 I got conflicting answers online. I think it should be stored in permgen
space since the variable is part of the class definition.
What's your opinion? |
|
|
b******y 发帖数: 9224 | 14 I did some research. It seems to me that static variables, if they are
primitives, are stored in permgen, also object references.
Objects could be allocated in any heap. |
|
r*****l 发帖数: 2859 | 15 I know that but generally permgen size is quite small compared to normal
heap so it makes sense to store as less data as possible. |
|
r*****l 发帖数: 2859 | 16 This is too vague and most people know it.
My two specific questions are:
1, If static variable is stored in permgen
2, Proof whether the answer is yes or no. |
|
e*****t 发帖数: 1005 | 17 permgen is mainly for class metadata, the maximum I have seen so far is abou
t 256M. You can certanly give more, but what's the point, if it will never r
each that. |
|
w****n 发帖数: 127 | 18 loaded classes数量不断上升,但是PermGen memory并没有一直增加。大牛说说这些
class都哪去了,被GC了? |
|
w**z 发帖数: 8232 | 19 loaded classes 是instance 吧, permgen 存的是class metadata. |
|
|
OE 发帖数: 369 | 21 想知道JVM内部到底是如何实现string pool的。
string pool里存的到底是string objects还是string references?
string pool和class constant pool的关系是什么样的?
public class hello1{
public static String s="Hello!"
}
public class hello2{
public static void main (String[] args){
String s = "Hello!";
System.out.println(s==hello1.s);//this is true
}
}
if you check the constant pool in .class files, you can see both classes
have "#n = Utf8 Hello!" in their constant pool. 但我猜,当JVM load这两个
classes,它们各自的runtime constant pool把"Hello1"存成... 阅读全帖 |
|
OE 发帖数: 369 | 22 想知道JVM内部到底是如何实现string pool的。
string pool里存的到底是string objects还是string references?
string pool和class constant pool的关系是什么样的?
public class hello1{
public static String s="Hello!"
}
public class hello2{
public static void main (String[] args){
String s = "Hello!";
System.out.println(s==hello1.s);//this is true
}
}
if you check the constant pool in .class files, you can see both classes
have "#n = Utf8 Hello!" in their constant pool. 但我猜,当JVM load这两个
classes,它们各自的runtime constant pool把"Hello1"存成... 阅读全帖 |
|
z*******3 发帖数: 13709 | 23 The JDK 8 HotSpot JVM is now using native memory for the representation of
class metadata and is called Metaspace; similar to the Oracle JRockit and
IBM JVM's.
* UPDATE: PermGen space is official removed in Java 8 and replaced by
Metaspace. |
|
|
z****e 发帖数: 54598 | 25 我给你来个列表,看你能懂多少概念
基本上都是轮子
java
jvm
awt
swt
applet
webstart
swing
javafx
rmi
ejb
sessionbean
entitybean
messagebean
jms
spring
struts
webflow
hibernate
ibatis
ant
gradle
maven
ivy
jboss
eclipse
android
jar
gc
g1
permgen
j2ee
serlvet
jsp
jca
web service
jax-rs
xml
json
annotation
singleton
design patterns
nio
security
dom
sax
hadoop
yarn
vert.x
rxjava
jdbc
jsf
validation
persistence
orm
transaction
javax.util.concurrent
websocket
jruby
jython
rhino
groovy
scala
clojure
polyglot
cassandra
hbase
weka... 阅读全帖 |
|
T********i 发帖数: 2416 | 26 你这个就无聊了吧?
我多年前曾经费尽心思要找把数据allocate在permgen的方法。看来这个Java还是个费
二遍事的。 |
|
T********i 发帖数: 2416 | 27 Object pool是我做的,我7-8年前做的。当年还研究过permgen的问题。但是多年没打
理了。
这个Stop GC。是别人的,正在production。我认为有趣的是每天要有几次停止交易
recycle。因此提出来而已。
没啥可死撑的。我这人有任何不严谨的地方从来都立刻承认。我说了,我1000个帖子里
犯过几次错误?有不承认的么?你都可以一一列举。
反过来说,你呢?xadd和cmpexch认了么? |
|
z****e 发帖数: 54598 | 28 哈哈哈,你不是都承认了吗?
你装了那么久有用么?
还很多年以前就在找放在permgen的方法
笑死人了,装啥呀
早就看出来你丫一外行,后来靠着死赖从我们这里偷了不少东西去
上次就没有给你太多hint,果然丫的不知道,哈哈
google都google不出来了吧?
五年硕士,外行,听说还是烂校哦 |
|
|