Last night chatting with friends, drinking a little coffee, because I often drink tea, a long time without coffee, so insomnia, and then get up to read the JVM specification, after reading in a friend Circle sent a message:
JVM run-time data areas:the Java Virtual machine defines various run-time data areas that is used during execution of a P Rogram. Some of these data areas is created on Java Virtual machine start-up and is destroyed only if the Java virtual machine Exits. Other data areas is per thread. Per-thread data areas was created when a thread was created and destroyed when the thread exits. Http://url.cn/eyfKNQ
Wake up in the morning and found a friend's reply:
Brother Chuan, there has been a doubt. Previously learned that Java memory for heap memory is divided into the Cenozoic, the old age belt, and the constant pool and bytecode files belong to the perpetual with memory, here is how to belong to the method area ~ For the Java memory is divided into heap and non-heap and what dimensions are divided
My reply is as follows:
Before you know it right, "permanent generation" (permanent band) is the concept of one of the implementations of the JVM specification (that is, the hotspot), and "Method area" (the method area) is the concept in the JVM specification, Explicitly stated in the JVM specification: The method area is logically part of the heap, and the specification does not enforce the location of the specified method area in memory (see Specification 2.5.4 section Description: although the method area is logically part of the heap, simple implementations may choose not to either garbage collect or compact it. This Specification does not mandate the location of the method area or the policies used to manage compiled code.) in the latest hotspot, it has been removed from the Permanent generation ":the permanent generation (PermGen) space has been replaced by a new space called Metaspace. how to differentiate between heaps (heap) and non-heap (non Heap), I think it is necessary to grasp the definition of the heap, the first to say that the heap is used for storage class instances (class instances ) and Arrays (arrays), and later that the method area (Method area) is logically also part of the heap, of course, In addition to these two parts, the others are non-heap (NON HEAP) (see Specification 2.5.3 section Description: the heap is the run-time data area from which memory for all class instances and arrays is allocated.)
Students with different ideas or doubts are welcome to discuss together!
Are you confused about the specification and implementation?