Is static immutable set and list immediately promoted to old gen in java 17 with G1 (hotspot VM)

35 Views Asked by At

For example

class myClass {
    public static final Set<String> s2 = Set.of("val1", "val2".........);
}

Once the class is loaded, where does jvm store these static sets in memory? Does it go through eden -> survivor -> tenured? Or straight to tenured?

Will jvm ever deallocate the static object once its allocated?

0

There are 0 best solutions below