提交 e1049604 编写于 作者: C coleenp

8224847: gc/stress/TestReclaimStringsLeaksMemory.java fails with reserved greater than expected

Summary: Rehash threshold was too low for StringTable, and rehashed size table was too large.
Reviewed-by: rehn, gziemski
上级 2df6408b
......@@ -57,8 +57,8 @@
#define PREF_AVG_LIST_LEN 2
// 2^24 is max size
#define END_SIZE 24
// If a chain gets to 32 something might be wrong
#define REHASH_LEN 32
// If a chain gets to 100 something might be wrong
#define REHASH_LEN 100
// If we have as many dead items as 50% of the number of bucket
#define CLEAN_DEAD_HIGH_WATER_MARK 0.5
......@@ -558,8 +558,9 @@ bool StringTable::do_rehash() {
return false;
}
// We use max size
StringTableHash* new_table = new StringTableHash(END_SIZE, END_SIZE, REHASH_LEN);
// We use current size, not max size.
size_t new_size = _local_table->get_size_log2(Thread::current());
StringTableHash* new_table = new StringTableHash(new_size, END_SIZE, REHASH_LEN);
// Use alt hash from now on
_alt_hash = true;
if (!_local_table->try_move_nodes_to(Thread::current(), new_table)) {
......
......@@ -55,7 +55,7 @@ public class TestReclaimStringsLeaksMemory {
public static void main(String[] args) throws Exception {
ArrayList<String> baseargs = new ArrayList(Arrays.asList( "-Xms256M",
"-Xmx256M",
"-Xlog:gc*",
"-Xlog:gc*,stringtable*=debug:gc.log",
"-XX:NativeMemoryTracking=summary",
"-XX:+UnlockDiagnosticVMOptions",
"-XX:+PrintNMTStatistics" ));
......@@ -93,9 +93,19 @@ public class TestReclaimStringsLeaksMemory {
lastString = (BaseName + i).intern();
}
if (++iterations % 5 == 0) {
System.gc();
System.gc();
}
}
// Do one last GC and sleep to give ServiceThread a chance to run.
System.out.println("One last gc");
System.gc();
for (int i = 0; i < 100; i++) {
try {
Thread.sleep(10);
} catch (InterruptedException ex) {
}
}
System.out.println("End of test");
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册