Can we avoid interning of strings in java?

后端 未结 4 735
傲寒
傲寒 2020-12-20 01:51

Can we completely disable interning of strings. It might not be really helpful, but just a thought. I can think atleast one point where it could be helpful i.e. during jvm t

4条回答
  •  醉梦人生
    2020-12-20 02:28

    Permgen size/usage isn't an issue with modern JVMs. Interned strings are made available to the garbage collector when there are no remaining references to them.

    (And no, you can't "turn off" interning of string literals).

提交回复
热议问题