jdk8 静态变量和静态方法放在哪个区域
来源:6-10 Java内存模型之线程共享部分
慕尼黑7546459
2019-03-21
老师,jdk7及之前,静态变量是放在永久代的,jdk8之后,永久代被移除,我看网上的一些文章说是, 类信息、方法信息这些编译后的数据放到了元空间(使用本地内存),但是静态变量和常量池是放到堆中的,而正常的堆又分成年轻代和老年代, 那它具体是放到哪里了呢
2回答
-
翔仔
2019-03-22
同学好,
Static methods and variables have been Stored in the PERMGEN space before the 8th version of the java. But,now they have introduced a new memory space called METASPACE now this is the place where all those name and fields of the class, methods of a class with the bytecode of the methods, constant pool, JIT optimizations etc are stored. Reason for removing PERMGEN in java 8.0 is It is very hard to predict the required size of PERMGEN.It helps in improving Garbage Collection Performance and Class data-de allocation.
JDK8之后,类信息、常量池、静态变量、方法数据、方法代码等存储在元空间里,通常也叫做"非堆"
022019-12-25 -
慕标6355498
2019-03-22
我觉得应该就是存在放元空间中的,先mark一下,看老师怎么回答
00
相似问题