标签:reference new addition bre eve org prim compile news
In JDK-6962930[2], it requested that string table size be configurable. The resolved date of that bug was on 04/25/2011 and it‘s available in JDK 7. In another JDK bug[3], it has requested the default size (i.e. 1009) of string table be increased.
In this article, we will examine the following topics:
In Java, string interning[1] is a method of storing only one copy of each distinct string value, which must be immutable. Interning strings makes some string processing tasks more time- or space-efficient at the cost of requiring more time when the string is created or interned. The distinct values are stored in a string intern pool, which is the string table in HotSpot.
The size of the string table (i.e., a chained hash table) is configurable in JDK 7. When the overflow chains become long, performance can degrade. The current default size of string table is 1009 (or 1009 buckets), which is too small for applications that stress the string table. Note that the string table itself is allocated in native memory but the strings are java objects.
Increasing the size improves performance (i..e, reducing look-up cost) but increases the StringTable size by 16 bytes on 64-bit systems, 8 bytes on 32-bit systems for every additional entry. For example, changing the default size to 60013 increases the String Table size by 460K on 32 bit systems.
In HotSpot, it provides a product level option named PrintStringTableStatistics which can be used to print hash table statistics[4]. For example, using one of our applications (hereafter will be referred as JavaApp), it prints out the following information:
Understanding String Table Size in HotSpot
标签:reference new addition bre eve org prim compile news
原文地址:http://www.cnblogs.com/zhaoxinshanwei/p/7570220.html