0

jdk1.8以降で、MetaspaceTestクラスをjvmにロードする際のメモリレイアウトについての私の理解ですが、そうでしょうか?

public class MetaspaceTest {
    /* 
     1. "a" would be interned into the global String Table of heap;
     2. object created by [new String("a")] would be placed in heap;
     3. constant STR_OBJ would be placed in the constant-pool of MetaspaceTest class info, 
        and pointing to the string object created by [new String("a")];
    */
    private final static String STR_OBJ = new String("a");
    /* 
     4. "b" would be interned in the global String Table of heap;
     5. static field literalStr would be placed in metaspace, 
       and pointing to the string "b" which is interned into the global String Table of heap;
    */
    private static String literalStr = "b";
    /*
     6. object created by [new Integer(8)] would be placed in heap;
     7. static field intNum would be placed in metaspace, 
       and pointing to the object created by [new Integer(8)];
    */
    private static Integer intNum = new Integer(8);
}
4

1 に答える 1