From f23aecfdbfc47bfe75039924bc3404b50faecee2 Mon Sep 17 00:00:00 2001 From: Ethan Atkins Date: Tue, 8 Sep 2020 11:08:19 -0700 Subject: [PATCH] Suggest using alternate gc implementation Running publishLocal in the zinc project can cause gc thrashing with the default parallelgc collector using jdk8 on my laptop. If I switch to G1GC, it does not thrash even if I leave the heap the same size. --- main/src/main/scala/sbt/internal/GCMonitor.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main/src/main/scala/sbt/internal/GCMonitor.scala b/main/src/main/scala/sbt/internal/GCMonitor.scala index 4223a110f..e83b53ac3 100644 --- a/main/src/main/scala/sbt/internal/GCMonitor.scala +++ b/main/src/main/scala/sbt/internal/GCMonitor.scala @@ -38,7 +38,8 @@ class GCMonitor(logger: Logger) extends AutoCloseable { if ((total > window.toMillis * ratio) && (lastWarned.get + window).isOverdue) { lastWarned.set(Deadline.now) val msg = s"${total / 1000.0} seconds of the last $window were spent in garbage " + - "collection. You may want to increase the project heap size for better performance." + "collection. You may want to increase the project heap size using `-Xmx` or try " + + "a different gc algorithm, e.g. `-XX:+UseG1GC`, for better performance." logger.warn(msg) } }