8199009: test/jdk/java/util/Locale/SoftKeys.java fails with OutOfMemoryError
Reviewed-by: psandoz, naoto
This commit is contained in:
parent
1926d24306
commit
54b1510aa7
@ -35,15 +35,25 @@ public class SoftKeys {
|
|||||||
private static final char[] CHARS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
|
private static final char[] CHARS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
// With 4 characters in "language", we'll fill up a 16M heap quickly,
|
try {
|
||||||
// causing full GCs and SoftReference reclamation. Repeat at least two
|
// With 4 characters in "language", we'll fill up a 16M heap quickly,
|
||||||
// times to verify no NPEs appear when looking up Locale's whose
|
// causing full GCs and SoftReference reclamation. Repeat at least two
|
||||||
// softly referenced data in sun.util.locale.BaseLocale$Key might have
|
// times to verify no NPEs appear when looking up Locale's whose
|
||||||
// been cleared.
|
// softly referenced data in sun.util.locale.BaseLocale$Key might have
|
||||||
for (int i = 0; i < 2; i++) {
|
// been cleared.
|
||||||
for (int j = 0; j < 512*1024; j++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
new Locale(langForInt(j), "", "");
|
for (int j = 0; j < 512*1024; j++) {
|
||||||
|
new Locale(langForInt(j), "", "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (OutOfMemoryError e) {
|
||||||
|
// Can happen on some system configurations, and while increasing heap
|
||||||
|
// size would allow GC to keep up, it also makes it impractically hard
|
||||||
|
// to reproduce NPE issues that could arise when references are being
|
||||||
|
// cleared.
|
||||||
|
|
||||||
|
// Do a System.gc() to not throw an OOME again in the jtreg wrapper.
|
||||||
|
System.gc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user