-
Notifications
You must be signed in to change notification settings - Fork 21
deserializing large mutable.HashMaps results in ArrayIndexOutOfBoundsExceptions #5632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Imported From: https://issues.scala-lang.org/browse/SI-5632?orig=1 |
@dcsobral said: |
@dlwh said (edited on Mar 30, 2012 8:25:10 PM UTC): scala> 2147484 * 1.0 / Int.MaxValue
res5: Double = 0.0010000001643784345
scala> |
@dlwh said: // Hashtable.scala
private[collection] final def defaultLoadFactor: Int = 750 // corresponds to 75%
private[collection] final def loadFactorDenum = 1000;
// ...
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
|
@non said: |
@dlwh said: |
@non said: I encourage you to write a test that catches this issue to help confirm that you fixed it and also prevent future regressions. Makes testing your patch easier on the commiter. |
@dlwh said: |
Basically, put 2147484 entries in a hashmap. write to disk. try to read from disk. kaboom! ArrayIndexOutOfBoundsExceptions. 2147483 is fine. Yeah, I did the binary search.
The text was updated successfully, but these errors were encountered: