Permalink
Browse files

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
  • Loading branch information...
1 parent 949a480 commit 95f0de0d1562f99dba4b03d34479980a026dc3ca @dlwh dlwh committed with paulp Mar 31, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/library/scala/collection/mutable/HashTable.scala
@@ -354,7 +354,7 @@ private[collection] object HashTable {
private[collection] final def newThreshold(_loadFactor: Int, size: Int) = ((size.toLong * _loadFactor) / loadFactorDenum).toInt
- private[collection] final def sizeForThreshold(_loadFactor: Int, thr: Int) = thr * loadFactorDenum / _loadFactor
+ private[collection] final def sizeForThreshold(_loadFactor: Int, thr: Int) = ((thr.toLong * loadFactorDenum) / _loadFactor).toInt
private[collection] final def capacity(expectedSize: Int) = if (expectedSize == 0) 1 else powerOfTwo(expectedSize)

0 comments on commit 95f0de0

Please sign in to comment.