-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
OutOfMemoryError in dotty.tools.dotc.core.Types #10900
Comments
This bug report is not actionable without a reproduction. Furthermore, it would really help if you could minimize it to a single file!
Depending on the size of your code base you can shrink your project iteratively by first replace the body of all your methods with |
I did try it with M2 about a week ago, with the same outcome.
Hmm, I'm afraid the code base is quite a bit too large for that. Is there a way to log what compilation unit the compiler is currently working on? Based on the stack trace it seems like dotty is stuck in an infinite loop trying to resolve a type reference, so it would help to know what type it's stuck on, or at least in which module the reference is located. |
What was the largest memory you tried it with? What were the warning messages then? |
@odersky GC Warnings
Memory usage summary
Stacktrace (relevant thread only)
|
You can get detailed info if you re-build the compiler. In file inline val tracingEnabled = false to inline val tracingEnabled = true Then, in file val typr = noPrinter to val typr = new Printer Then compile your application again with the setting -Ylog:typer. That will give a you very detailed trace of all the steps the compiler is taking. |
Thanks @odersky. This reproduces the problem: object CollectionEnhancements {
import scala.collection.IterableOps
implicit class RichCollection[CC[A] <: IterableOps[A, CC, CC[A]], A](val collection: CC[A]) {
def awm(update: CC[A] => CC[A]): CC[A] = {
val newCollection = update(collection)
if (newCollection == collection) collection else newCollection.awm(update)
}
/* // or:
def awm(update: CC[A] => CC[A]): CC[A] = update(collection) match {
case `collection` => collection
case updated => updated.awm(update)
}
*/
}
} Should I create a pull requests with this case added to |
@marcus-nl This is sufficient, thanks! |
This is further minimized to the following: import scala.collection.IterableOps
def foo[CC[A] <: IterableOps[A, CC, CC[A]], A](collection: CC[A]) =
collection == collection Now the compiler reports a very big type error (the same for the minimized snippet above). |
The code fails in |
Fix #10900: Avoid loop for F-bounds in checkCanEqual
While trying out M3, aka the Developer's Preview (using SBT 1.4.4 and sbt-dotty 0.5.1), on our Scala 2.13 codebase, dotty crashes with an OutOfMemory error.
First I get these warnings (increasing available memory or using G1GC doesn't help):
And then eventually:
I've pasted an extract of the stacktrace below, creating using control-\ while it was still running.
Minimized code
n/a since I don't know where it went wrong. Is there any way I can pinpoint this?
Output (click arrow to expand)
The text was updated successfully, but these errors were encountered: