mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-30 04:58:25 +00:00
8224847: gc/stress/TestReclaimStringsLeaksMemory.java fails with reserved greater than expected
Rehash threshold was too low for StringTable, and rehashed size table was too large. Reviewed-by: rehn, gziemski
This commit is contained in:
parent
02f1d4430c
commit
d571d105ae
@ -58,8 +58,8 @@
|
||||
const double PREF_AVG_LIST_LEN = 2.0;
|
||||
// 2^24 is max size
|
||||
const size_t END_SIZE = 24;
|
||||
// If a chain gets to 32 something might be wrong
|
||||
const size_t REHASH_LEN = 32;
|
||||
// If a chain gets to 100 something might be wrong
|
||||
const size_t REHASH_LEN = 100;
|
||||
// If we have as many dead items as 50% of the number of bucket
|
||||
const double CLEAN_DEAD_HIGH_WATER_MARK = 0.5;
|
||||
|
||||
@ -496,8 +496,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)) {
|
||||
|
||||
@ -267,7 +267,7 @@ void SymbolTable::symbols_do(SymbolClosure *cl) {
|
||||
// all symbols from the dynamic table
|
||||
SymbolsDo sd(cl);
|
||||
if (!_local_table->try_scan(Thread::current(), sd)) {
|
||||
log_info(stringtable)("symbols_do unavailable at this moment");
|
||||
log_info(symboltable)("symbols_do unavailable at this moment");
|
||||
}
|
||||
}
|
||||
|
||||
@ -557,7 +557,7 @@ void SymbolTable::verify() {
|
||||
Thread* thr = Thread::current();
|
||||
VerifySymbols vs;
|
||||
if (!_local_table->try_scan(thr, vs)) {
|
||||
log_info(stringtable)("verify unavailable at this moment");
|
||||
log_info(symboltable)("verify unavailable at this moment");
|
||||
}
|
||||
}
|
||||
|
||||
@ -763,8 +763,9 @@ bool SymbolTable::do_rehash() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// We use max size
|
||||
SymbolTableHash* new_table = new SymbolTableHash(END_SIZE, END_SIZE, REHASH_LEN);
|
||||
// We use current size
|
||||
size_t new_size = _local_table->get_size_log2(Thread::current());
|
||||
SymbolTableHash* new_table = new SymbolTableHash(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)) {
|
||||
|
||||
@ -77,7 +77,6 @@ gc/stress/gclocker/TestGCLockerWithParallel.java 8180622 generic-all
|
||||
gc/stress/gclocker/TestGCLockerWithG1.java 8180622 generic-all
|
||||
gc/stress/TestJNIBlockFullGC/TestJNIBlockFullGC.java 8192647 generic-all
|
||||
gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java 8193639 solaris-all
|
||||
gc/stress/TestReclaimStringsLeaksMemory.java 8224847 generic-all
|
||||
|
||||
#############################################################################
|
||||
|
||||
|
||||
@ -57,7 +57,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" ));
|
||||
@ -95,9 +95,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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user