Skip to content

Commit 95f0de0

Browse files
dlwhpaulp
authored andcommitted
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 949a480 commit 95f0de0

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
@@ -354,7 +354,7 @@ private[collection] object HashTable {
354354

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

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

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

0 commit comments

Comments
 (0)