Skip to content
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

StackOverflowError when using mutable.ListMap.+= method #6853

Closed
scabug opened this issue Dec 20, 2012 · 2 comments
Closed

StackOverflowError when using mutable.ListMap.+= method #6853

scabug opened this issue Dec 20, 2012 · 2 comments
Assignees
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Dec 20, 2012

The implementation of the += method uses remove(key: A, elems: List[(A, B)]): List[(A, B)], which is not tail recursive.

A quick way to reproduce it in the REPL:

scala> val m = collection.mutable.ListMapString, Int
m: scala.collection.mutable.ListMap[String,Int] = Map()

scala> var i = 0
i: Int = 0

scala> while(i < 80000) { m = ("foo" i) -> i; i = i+1}
java.lang.StackOverflowError
at scala.collection.mutable.ListMap.remove(ListMap.scala:56)
at scala.collection.mutable.ListMap.remove(ListMap.scala:56)
at scala.collection.mutable.ListMap.remove(ListMap.scala:56)
...

@scabug
Copy link
Author

@scabug scabug commented Dec 20, 2012

Imported From: https://issues.scala-lang.org/browse/SI-6853?orig=1
Reporter: Stephane Godbillon (sgodbillon)
Affected Versions: 2.10.0-RC5

@scabug
Copy link
Author

@scabug scabug commented Jan 19, 2013

@ViniciusMiana said (edited on Jan 24, 2013 12:32:04 AM UTC):
Fix in scala/scala#1960

@scabug scabug closed this Feb 1, 2013
@scabug scabug added this to the 2.10.1 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants