Skip to content

Commit 88bc333

Browse files
committed
Fixes SI-5632 (serialization of large HashTables)
Converts HashTable threshold to long before multiplying by a large value. Test is very slow and requires giving partest more RAM. Rather than committing it, I'm attaching it as a gist. Whoever does the merge is more than welcome to commit it along with this patch… Test: https://gist.github.com/2257703
1 parent dc8b431 commit 88bc333

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/library/scala/collection/mutable/HashTable.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ private[collection] object HashTable {
366366

367367
private[collection] final def newThreshold(_loadFactor: Int, size: Int) = ((size.toLong * _loadFactor) / loadFactorDenum).toInt
368368

369-
private[collection] final def sizeForThreshold(_loadFactor: Int, thr: Int) = thr * loadFactorDenum / _loadFactor
369+
private[collection] final def sizeForThreshold(_loadFactor: Int, thr: Int) = ((thr.toLong * loadFactorDenum) / _loadFactor).toInt
370370

371371
private[collection] final def capacity(expectedSize: Int) = if (expectedSize == 0) 1 else powerOfTwo(expectedSize)
372372

0 commit comments

Comments
 (0)