-
Bug
-
Resolution: Won't Fix
-
P4
-
None
-
1.3.0, 1.3.1
-
generic, x86
-
generic, windows_nt, windows_2000
Name: md23716 Date: 08/28/2001
String.intern() fails (internal memory allocation failure) when a large number of String objects are interned and can not be garbage collected by the JVM.
In JDK 1.3.0 and 1.3.1 this is giving error message "Exception in thread main".
There is also a SUNBUG:4035345 on the same problem. The bug was raised against 100000 string objects but the customer's testcase consists of 2000000 string objects. In the SUNBUG they mentioned as "fixed in 1.2.2" . But the customer's testcase fails in SUN JDK 1.2.2 also.
Test case:
public class Test
{
static private final int max = 2000000;
static public void main( String[] args )
{
String[] holder = new String[ max ];
for ( int i = 0; i < max; i++ ) {
try {
holder[ i ] = new String( Integer.toString( i ).intern() );
} catch ( Throwable t ) {
t.printStackTrace();
System.err.println( t.toString() );
}
}
}
}
======================================================================
- duplicates
-
JDK-4439922 String.intern() has fatal error when too many strings are interned.
- Closed