Does String Pool exist in both the young and the old generation?

Of the strings embedded in Java 7, they are no longer stored in the permengen area. Rather, they are stored in a regular heap, which means they have to go through half the GC and the full GC. Now, after half the GC, those interned String that survive must be transferred from the young to the old generation.

  • Does this mean that both young and old generations have this survey?

Next, indicate the line inside the internee. They I define a string literal with the same content, then in this case it should point to the same string value in the pool.

  • So, the JVM should be strewed for String in both the young and the old generation and return a link to the string instance approriate. Is my thinking right?
+4
source share
1 answer

You are misleading the logic of the intern table with its physical location in memory. Table-to-table is simply a hash table with a chain in a collision, logically (although not physically), similar to a HashMap. When interpolating a string, the JVM hashes it, then looks into the corresponding bucket and returns the string that it finds, or adds a new string to the bucket.

. , , G1 ( ) . , JVM - /, /, .

+2

All Articles