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:
Coleen Phillimore 2019-06-11 07:31:47 -04:00
parent 02f1d4430c
commit d571d105ae
4 changed files with 22 additions and 11 deletions

View file

@ -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)) {