Vivek Panday
Vivek Panday

Reputation: 1436

What is default size of String constant pool in Java?

I want to understand is there any default size given to string constant pool?

Is there any variation in string constant pool in different version on java? What is default size of String constant pool?

Upvotes: 1

Views: 2148

Answers (2)

goodmove
goodmove

Reputation: 161

According to this article, String Constant pool size varies across different Java versions and releases (but the article itself is over 3 years old, so some changes on the newest Java releases might have been made since then).

The String Pool is implemented as a HashMap. So,

  1. Up until Java 6, the default Pool size is 1009 entries and is limited by PermGen size, which became configurable in Java6u30 release.
  2. In Java 7 the default hash table size was increased up to 60013 entries and is still configurable with flag -XX:StringTableSize=<value>.
  3. In Java 8 PermGen area was removed and constant pool was moved into heap, making its size limited only by the program's memory limit (and it still accepts the table size option).

Upvotes: 3

Saurav Sahu
Saurav Sahu

Reputation: 13994

In most of JVM default size of Perm Space is around "64MB".

Upvotes: 0

Related Questions